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

spawn instead of exec and piping child process output #13

Merged
merged 2 commits into from
Jun 28, 2018

Conversation

zaucy
Copy link
Contributor

@zaucy zaucy commented Jun 28, 2018

For my use case I needed the output to pipe directly to the processes output instead of waiting for the command to finish. I also ran into a maxBuffer issue due to the use of exec so I switched it to spawn.

This should help with #15 and #14

@AlexZeitler
Copy link
Contributor

Thanks. Please update this PR to include the changes from merged #8.

@zaucy
Copy link
Contributor Author

zaucy commented Jun 28, 2018

Done!

@AlexZeitler AlexZeitler merged commit b31ec18 into PDMLab:master Jun 28, 2018
@AlexZeitler
Copy link
Contributor

@zaucy Somehow I merged to fast and tests fail:

TAP version 13
# ensure container gets started
Starting compose_test_apline ... 
Starting compose_test_apline ... done
not ok 1 test exited without ending
  ---
    operator: fail
  ...
not ok 2 test exited without ending
  ---
    operator: fail
  ...
not ok 3 test exited without ending
  ---
    operator: fail
  ...
not ok 4 test exited without ending
  ---
    operator: fail
  ...
not ok 5 test exited without ending
  ---
    operator: fail
  ...
not ok 6 test exited without ending
  ---
    operator: fail
  ...
not ok 7 test exited without ending
  ---
    operator: fail
  ...

1..7
# tests 7
# pass  0
# fail  7

@AlexZeitler
Copy link
Contributor

Looks like this is caused by the .spawn() call. spawn doesn't support passing a callback.

@AlexZeitler
Copy link
Contributor

Something like this makes it work:

  childProc = childProcess.spawn('docker-compose', concat, { cwd, env });
  if (options.log) {
    childProc.stdout.pipe(process.stdout);
    childProc.stderr.pipe(process.stderr);
    resolve();
  } else {
    resolve();
  }

Yet, when running the tests, they still fail as resolve() gets called to early if services need to be build/ images pulled etc.

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

Successfully merging this pull request may close these issues.

None yet

2 participants