Add COMMAND env variable support for shell command
This commit is contained in:
6
main.go
6
main.go
@@ -81,7 +81,11 @@ func handleChannel(channel ssh.Channel, requests <-chan *ssh.Request) {
|
||||
req.Reply(true, nil)
|
||||
case "shell":
|
||||
req.Reply(true, nil)
|
||||
cmd := exec.Command("/app/tui")
|
||||
command := os.Getenv("COMMAND")
|
||||
if command == "" {
|
||||
command = "/app/tui"
|
||||
}
|
||||
cmd := exec.Command(command)
|
||||
cmd.Env = []string{"PATH=/bin"}
|
||||
cmd.Dir = "/"
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user