Repository navigation
fix: don't treat inline shell commands containing .json/.yaml as config files - #6181
Open
thelastbackspace wants to merge 1 commit into
Open
thelastbackspace wants to merge 1 commit into
thelastbackspace wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #5945
pm2 start 'cd app && uvicorn server:app --log-config log_config.yaml'fails withFile ... not found.API.startusesCommon.isConfigFile(cmd), which is a substring check on the extension, so any command string that mentions a.json/.yml/.yaml/.config.jsfile gets sent to_startJsonand pm2 tries to read the whole command as a file path.I didn't want to tighten
isConfigFileitself, since it's used in a lot of places (andecosystem.json5currently relies on the.jsonmatch). Insteadstartnow checks one more thing: if the string has whitespace and doesn't exist as a file (resolved against the API cwd, same as_startJson), it's handled as a script/command like any other quoted command. Config paths with spaces in them still work because they exist on disk.Added
test/programmatic/issue_5945_inline_command_config_ext.mocha.js(registered intest/unit.sh). It starts a.yamland a.jsoninline command and also checks that a real config file still goes through_startJson. The first case fails on master with the "not found" error and passes with the change.