Skip to content

Conversation

@kruffin
Copy link

@kruffin kruffin commented Oct 13, 2015

When using the "command" option to run scripts like npm that fail, the error does not get propagated back to the calling process. This fix catches those errors and re-emits them.

Errors from test case on current code:
♢ forever-monitor/monitor/simple
(node) util.print is deprecated. Use console.log instead.
✗ Errored » callback not fired
in attempting to start a command where the path and file do not exist
in forever-monitor/monitor/simple
in test/monitor/simple-test.js
✗ Errored » callback not fired
in When using forever-monitor an instance of Monitor with valid options
in forever-monitor/monitor/simple
in test/monitor/simple-test.js
✗ Errored » callback not fired
in When using forever-monitor running error-on-timer sample three times
in forever-monitor/monitor/simple
in test/monitor/simple-test.js
✗ Errored » callback not fired
in When using forever-monitor running error-on-timer sample once
in forever-monitor/monitor/simple
in test/monitor/simple-test.js
✗ Errored » callback not fired
in When using forever-monitor non-node usage with a perl one-liner
in forever-monitor/monitor/simple
in test/monitor/simple-test.js
✗ Errored » callback not fired
in When using forever-monitor passing node flags through command
in forever-monitor/monitor/simple
in test/monitor/simple-test.js
✗ Errored » callback not fired
in When using forever-monitor attempting to start a script that doesn't exist
in forever-monitor/monitor/simple
in test/monitor/simple-test.js
✗ Errored » callback not fired
in When using forever-monitor attempting to start a command with node in the name
in forever-monitor/monitor/simple
in test/monitor/simple-test.js

Successful test after the fix:
♢ forever-monitor/monitor/simple
attempting to start a command where the path and file do not exist
✓ should throw an error about the invalid file
When using forever-monitor an instance of Monitor with valid options
✓ should have correct properties set
When using forever-monitor attempting to start a script that doesn't exist
✓ should throw an error about the invalid file
When using forever-monitor non-node usage with a perl one-liner
✓ should get back moo
When using forever-monitor an instance of Monitor with valid options calling the restart() method in less than minUptime
✓ should restart the child process
When using forever-monitor passing node flags through command
✓ should get back function
When using forever-monitor attempting to start a command with node in the name
✓ should run the script
When using forever-monitor running error-on-timer sample once
✓ should emit 'exit' when completed
When using forever-monitor running error-on-timer sample three times
✓ should emit 'exit' when completed

Kevin Ruffin and others added 3 commits October 13, 2015 13:01
…iled command causes

no information to be passed back to the calling process.
Fixes a bug where calling stop() after restart() still restarts the process.
TODO: Create tests to showcase the behavior.
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.

1 participant