Skip to content

[WINDOWS] spawn stdio not piping #5713

Closed

Description

@farfromrefug
  • 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.

Activity

  1. zcbenz commented on May 29, 2016

    @zcbenz
    Contributor

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

  2. farfromrefug commented on May 30, 2016

    @farfromrefug
    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

  3. farfromrefug commented on May 31, 2016

    @farfromrefug
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions