下面的代码将启动Electron应用程序,但是,主过程中的console.log()
将不可用。
import executeExternalCommand, { ExecaReturnValue } from 'execa';
async startInitializeProjectGUI(): Promise<void> {
const executionResult: ExecaReturnValue<string> = await executeExternalCommand(
'electron',
['InitializeProject_GUI.js'], // console.log() is here
{ cwd: __dirname }
);
if (executionResult.failed) {
Promise.reject(new Error('Can not start "electron"'));
}
return;
}
如何使用execa获取子进程的控制台输出?