Work around an edge-case in pm2 start() #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If 'pm2' detects a space in the 'script' path, it assumes the call is something like "python foo.py". When that's the case, it transforms the call into
/bin/bash -c python foo.py
. Relevant pm2 code: https://github.com/Unitech/pm2/blob/24c35236f555a638e1f4c803b57d7e0769261482/lib/Common.js#L659This creates a problem for some hyperdrive apps because they may have spaces in their install paths. (This is the case for Beaker.) The resulting call ends up being
${interpreter} /bin/bash -c ${script}
, which is wrong. (To add a little more complexity, it does not do this on Windows because Windows has its own shell with its own resulting issues.)This PR solves the issue by using
/bin/bash -c
correctly with our own call if not windows.