How to get console.log() output from the child process in “execa”?

倾然丶 夕夏残阳落幕 提交于 2019-12-24 13:00:15

问题


Below code starts Electron application, however, console.log() from the main process will not be available.

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;
}

How can I get console output of child process with execa?

来源:https://stackoverflow.com/questions/56539690/how-to-get-console-log-output-from-the-child-process-in-execa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!