Skip to content

Fix for #16 #18

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

Closed

Conversation

andraaspar
Copy link

This fixes #16 .

@paulpflug
Copy link
Collaborator

could you try the version on dev branch?
there is a section in the new readme for nested calling of parallelshell.
It works for me, could you confirm?

@andraaspar
Copy link
Author

It does seem to work correctly when invoking it through npm, but I got the following test results:

> parallelshell@2.0.0 test d:\Temp\parallelshell
> mocha



  parallelshell
    1) should print on -h and --help
    2) should close with exitCode 1 on child error
    3) should run with a normal child
    4) should close sibling processes on child error
     should wait for sibling processes on child error when called with -w or --wait (400ms)
     should close on CTRL+C / SIGINT (140ms)
     should work with chained commands (140ms)
     should work nested (260ms)
     should work with setting ENV (230ms)
     should work with first (230ms)
     should not work with first and wait (120ms)


  7 passing (2s)
  4 failing

  1) parallelshell should print on -h and --help:
     Uncaught AssertionError: expected '-v, --verbose      verbose logging' to equal undefined
    at Socket.<anonymous> (d:\Temp\parallelshell\test\index.coffee:73:21)
    at _stream_readable.js:920:16


  2) parallelshell should close with exitCode 1 on child error:
     Uncaught AssertionError: expected '-v, --verbose      verbose logging' to equal undefined
    at Socket.<anonymous> (d:\Temp\parallelshell\test\index.coffee:73:21)
    at _stream_readable.js:920:16


  3) parallelshell should run with a normal child:

      Uncaught AssertionError: expected 8 to equal 1
      + expected - actual

      -8
      +1

    at ChildProcess.<anonymous> (d:\Temp\parallelshell\test\index.coffee:86:26)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Pipe.close (net.js:466:12)


  4) parallelshell should close sibling processes on child error:

      Uncaught AssertionError: expected 8 to equal 1
      + expected - actual

      -8
      +1

    at ChildProcess.<anonymous> (d:\Temp\parallelshell\test\index.coffee:104:26)
    at Process.ChildProcess._handle.onexit (child_process.js:789:12)




npm ERR! Test failed.  See above for more details.

@paulpflug
Copy link
Collaborator

Very strange. I have no Idea what exitcode 8 means.
How do you call the test? Within the test node ./index.js will be called, this should work when mocha or npm test is called from parallelshell root directory. One the other side it is very strange, that not all tests fail, as they are nearly identical.

@andraaspar
Copy link
Author

I called npm run test. It seems like it fails tests randomly. Look at this (this time executing mocha):

d:\Temp\parallelshell>node_modules\.bin\mocha


  parallelshell
    1) should print on -h and --help
    2) should close with exitCode 1 on child error
    3) should run with a normal child
    4) should close sibling processes on child error
    5) should wait for sibling processes on child error when called with -w or --wait
    √ should close on CTRL+C / SIGINT (182ms)
    √ should work with chained commands (150ms)
    √ should work nested (300ms)
    √ should work with setting ENV (302ms)
    √ should work with first (290ms)
    √ should not work with first and wait (130ms)


  6 passing (3s)
  5 failing

  1) parallelshell should print on -h and --help:
     Uncaught AssertionError: expected '-v, --verbose      verbose logging' to equal undefined
    at Socket.<anonymous> (d:\Temp\parallelshell\test\index.coffee:73:21)
    at _stream_readable.js:920:16


  2) parallelshell should close with exitCode 1 on child error:
     Uncaught AssertionError: expected '-v, --verbose      verbose logging' to equal undefined
    at Socket.<anonymous> (d:\Temp\parallelshell\test\index.coffee:73:21)
    at _stream_readable.js:920:16


  3) parallelshell should run with a normal child:

      Uncaught AssertionError: expected 8 to equal 1
      + expected - actual

      -8
      +1

    at ChildProcess.<anonymous> (d:\Temp\parallelshell\test\index.coffee:86:26)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Pipe.close (net.js:466:12)


  4) parallelshell should close sibling processes on child error:

      Uncaught AssertionError: expected 8 to equal 1
      + expected - actual

      -8
      +1

    at ChildProcess.<anonymous> (d:\Temp\parallelshell\test\index.coffee:104:26)
    at Process.ChildProcess._handle.onexit (child_process.js:789:12)


  5) parallelshell should wait for sibling processes on child error when called with -w or --wait:
     Error: timeout of 500ms exceeded. Ensure the done() callback is being called in this test.





d:\Temp\parallelshell>node_modules\.bin\mocha


  parallelshell
    1) should print on -h and --help
    2) should close with exitCode 1 on child error
    √ should run with a normal child (280ms)
    3) should close sibling processes on child error
    √ should wait for sibling processes on child error when called with -w or --wait (432ms)
    4) should close on CTRL+C / SIGINT
    √ should work with chained commands (170ms)
    √ should work nested (240ms)
    √ should work with setting ENV (230ms)
    √ should work with first (230ms)
    √ should not work with first and wait (120ms)


  7 passing (3s)
  4 failing

  1) parallelshell should print on -h and --help:
     Uncaught AssertionError: expected '-v, --verbose      verbose logging' to equal undefined
    at Socket.<anonymous> (d:\Temp\parallelshell\test\index.coffee:73:21)
    at _stream_readable.js:920:16


  2) parallelshell should close with exitCode 1 on child error:

      Uncaught AssertionError: expected 8 to equal 1
      + expected - actual

      -8
      +1

    at ChildProcess.<anonymous> (d:\Temp\parallelshell\test\index.coffee:86:26)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Pipe.close (net.js:466:12)


  3) parallelshell should close sibling processes on child error:

      Uncaught AssertionError: expected 8 to equal 1
      + expected - actual

      -8
      +1

    at ChildProcess.<anonymous> (d:\Temp\parallelshell\test\index.coffee:104:26)
    at Process.ChildProcess._handle.onexit (child_process.js:789:12)


  4) parallelshell should close on CTRL+C / SIGINT:
     Error: timeout of 500ms exceeded. Ensure the done() callback is being called in this test.

@andraaspar
Copy link
Author

npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'pretest', 'test', 'posttest' ]
6 info pretest [email protected]
7 info test [email protected]
8 verbose unsafe-perm in lifecycle true
9 info [email protected] Failed to exec test script
10 verbose stack Error: [email protected] test: `mocha`
10 verbose stack Exit status 6
10 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
10 verbose stack     at EventEmitter.emit (events.js:110:17)
10 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:14:12)
10 verbose stack     at ChildProcess.emit (events.js:110:17)
10 verbose stack     at maybeClose (child_process.js:1008:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
11 verbose pkgid [email protected]
12 verbose cwd d:\Temp\parallelshell
13 error Windows_NT 6.1.7601
14 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
15 error node v0.12.0
16 error npm  v2.5.1
17 error code ELIFECYCLE
18 error [email protected] test: `mocha`
18 error Exit status 6
19 error Failed at the [email protected] test script 'mocha'.
19 error This is most likely a problem with the parallelshell package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error     mocha
19 error You can get their info via:
19 error     npm owner ls parallelshell
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]

@andraaspar andraaspar closed this Sep 11, 2017
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.

Recursive call fails on Windows
2 participants