added trim() to complete command to allow file creation in ssh throug…#455
Merged
Conversation
…h command. Empty parameters array would add empty space after EOT.
steelbrain
requested changes
Jan 19, 2023
steelbrain
left a comment
Owner
There was a problem hiding this comment.
Thanks for pointing this out, left a comment
| } | ||
|
|
||
| const completeCommand = `${command} ${shellEscape(parameters)}` | ||
| const completeCommand = `${command} ${shellEscape(parameters)}`.trim(); |
Owner
There was a problem hiding this comment.
Instead of .trim at the end, let's take an alternative route, and do something like the following
`${command}${parameters.length ? ` ${shellEscape(parameters)}` : ''}`
Contributor
Author
There was a problem hiding this comment.
Okay I pushed alternative way like You've suggested.
Thank You
steelbrain
approved these changes
Jan 19, 2023
steelbrain
left a comment
Owner
There was a problem hiding this comment.
Thank you for working on this!
Owner
|
This changeset has been deployed in node-ssh@13.0.1 |
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.
Hi I've spotted problem with command execution when You want to use node-ssh to pass for example yaml structure in command with EOT at the end and empty options array it adds not wanted "space" and it breaks file creation. For that reason I've added trim() to fix the issue if no options are available.
Thank You,
Nicram97