我正在使用execa.shell
承诺来运行子进程,并且出于某种原因,即使它正在运行,也无需覆盖电话。
const getCode = async ({cmd, workingDir, stdio}) => {
try {
const commandResponse = await execa.shell(cmd, {cwd: workingDir, stdio})
return commandResponse.code
} catch (e) {
return e.code
}
}