我想節點的js代碼中執行以下命令執行shell腳本的NodeJS代碼中
diff <(git log 01) <(git log 02)
在命令行可以正常工作和gettig所需的輸出,我想
這裏是我的結點代碼
var command = "diff <(git log 01) <(git log 02)"
console.log(command)
exec(command, function (error, stdout, stderr) {
if (error !== null) {
console.log(error)
} else {
console.log(stdout)
}
}
});
不過,雖然上面的代碼執行我得到」
diff <(git 01) <(git log 02)
{ [Error: Command failed: /bin/sh: 1: Syntax error: "(" unexpected
] killed: false, code: 2, signal: null }