Add COMMAND env variable support for shell command

This commit is contained in:
2025-11-06 14:45:15 +01:00
parent 1f0cd36375
commit 8e6cbe38f0
4 changed files with 7 additions and 12 deletions

View File

@@ -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