Abiltity to specify command to run in SSH command#17
Open
Conversation
Member
Author
|
@rmccue in conjunction with https://github.com/humanmade/vantage-backend/pull/1733 I had an initial pass at this. Even with the ability to specify a different command though, we still get the |
rmccue
reviewed
Aug 17, 2023
Comment on lines
+121
to
+127
| // If this is the first output chunk and we're in porcelain mode, strip the initial 2 lines | ||
| // this contain somethign like: | ||
| // exec sudo sandbox-exec 'clear; $command' | ||
| // sh-4.2$ exec sudo sandbox-exec 'clear; $command' | ||
| if ( porcelain && firstOutput ) { | ||
| data = data.split( '\n' ).slice(2).join('\n').trim(); | ||
| } |
Member
There was a problem hiding this comment.
Something you can do here is use the clear itself; it outputs the ANSI control characters for clearing, so you can split on that. Even cleaner, change the backend command to output just the one code with something like
exec sudo sandbox-exec "printf '\033[2J'; $command"
And then here, data.split( '033[2J', 2 )[1]
rmccue
reviewed
Aug 17, 2023
Comment on lines
+129
to
+132
| // Strip the ANSI escape codes if we're in porcelain mode. | ||
| if ( porcelain ) { | ||
| data = data.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, ''); | ||
| } |
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.
See #16