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

i cannot use stdout.on, stderr.on with the promise #55

Open
patrikx3 opened this issue Apr 16, 2017 · 2 comments
Open

i cannot use stdout.on, stderr.on with the promise #55

patrikx3 opened this issue Apr 16, 2017 · 2 comments

Comments

@patrikx3
Copy link

hi! hey! hello!

simple, i can use simple native child process, and stream the stdout, stderr.
but with mz i cannot! :(

@LinusU
Copy link
Contributor

LinusU commented Apr 17, 2017

Hey, this probably will require some more manual wrapping, but it should be quite easy to do. Could you show some code examples on how you would like to use it?

I would also recommend execa which I think it amazing, we should try and draw some inspiration from that library :)

@patrikx3
Copy link
Author

HI!!!!
I guess it creates promises automatically, but unfortunately mz/child_process does not give back stdout, stderr stream... It gives all or nothing, stream is missing. for a lengthy process it is only shows the output at the end... :(

 return new Promise((resolve, reject) => {
            const run = execRaw(`bash -c '
set -e    
${project === 'corifeus' ? '' : `pushd ${project}`}
${command}
${project === 'corifeus' ? '' : `popd`}
'`, {
                stdio: `inherit`,
                customFds: [0,1,2]

            }, (e) => {
                if (e) {
                    console.error(e);
                    return reject(e);
                }
                bar.tick({
                    token: `${project} done`
                })
                return resolve();
            })
            run.stdout.on('data', (data) => {
                //bar.interrupt(data)
            });
            run.stderr.on('data', (data) => {
                bar.interrupt(data)
            });
        })

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

No branches or pull requests

1 participant