-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abiltity to specify command to run in SSH command #17
base: main
Are you sure you want to change the base?
Conversation
@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 |
// 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(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]
// 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, ''); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really safe to do
See #16