-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add inShell
parameter to for SSH command execution
#36
Conversation
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.
Looking good! Let's see if we can clean up these final bits. My main remaining question is if we should allow people to choose a shell (e.g. /bin/sh, /bin/bash, /bin/zsh)
Also nice to see a PR of yours! We're using Cilicon ourselves, so thank you for that :) |
Thanks for the review, this was just a super rough PoC with a bunch of copy-paste. Will clean it up tomorrow!
Great to hear! Citadel is making its way into Cilicon in an exciting 2.0 update soon 😊 |
I don't think SSH allows picking a shell. If I understood it correctly it will always uses the default shell of the logged in user.
|
@Marcocanc since this executes a command as the shell launches, I believe we can do something like |
Yeah I don't see much value in that tbh. After all users can just wrap their command that way themselves. |
Fair! Then I'm pretty happy with this |
executeInShell
inShell
parameter to for SSH command execution
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.
I dig this! Thanks for the PR! I f you don't mind, I want to let this sit for a day or so to review it in the back of my head
let commandData = SSHChannelData(type: .channel, | ||
data: .byteBuffer(ByteBuffer(string: command + ";exit\n"))) | ||
channel.writeAndFlush(commandData, promise: nil) | ||
hasReceivedChannelSuccess = true |
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.
My one nit is that hasReceivedChannelSuccess
should be always set, otherwise if we access that variable in a later feature down the line it will cause confusion
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.
I’m wondering why “exit” is always called after user’s command?
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.
@xuxulll because this is a helper that only executes a single command.
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.
@Joannis thanks for the explanation, do you have any plan to support interactive shell?
@Joannis Cilicon 2.0 (which includes Citadel) is now released 😊 https://github.com/traderepublic/Cilicon |
Cool! Thanks for the heads up @Marcocanc |
This PR adds the option to execute commands in a shell, by launching a shell channel request and sending the command into the channel once the request succeeded.