Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WINDOWS] spawn stdio not piping #5713

Closed
farfromrefug opened this issue May 26, 2016 · 3 comments · Fixed by #5776
Closed

[WINDOWS] spawn stdio not piping #5713

farfromrefug opened this issue May 26, 2016 · 3 comments · Fixed by #5776

Comments

@farfromrefug
Copy link

  • Electron version: 1.1.3
  • Operating system: Windows 10 64 bit

I have that script in my app:

const child = spawn(process.execPath, [info.path], {
            env: { "ATOM_SHELL_INTERNAL_RUN_AS_NODE": "0" },
            shell: false,
            detached: true
          });
          child.unref();
          child.stdout.on('data', (data) => {
            console.log('received data', data);
            term.write(data.toString());
          });

          child.stderr.on('data', (data) => {
            console.log('received data', data);
            term.write(data.toString());
          });

The idea is to spawn a node script and output its log within the main app view.

Now this works great on OSX, however it does not work on windows. The stdout and stderr are always output in the main process "console".
It feels like ```stdio: 'inherit' is always used.

@zcbenz
Copy link
Contributor

zcbenz commented May 29, 2016

I can reproduce this, it is probably because Electron is a GUI app and Windows doesn't pipe the output to console.

@farfromrefug
Copy link
Author

@zcbenz well i see the output in the console if i run my app from the console.
So i am not sure this is it.
i am wondering if it s related to this issue nodejs/node-v0.x-archive#3871

@farfromrefug
Copy link
Author

@zcbenz I managed to get it to work even before your PR :D
ELECTRON_NO_ATTACH_CONSOLE seems to have done the trick for me.
Will report on your PR when released.
Thanks for your work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants