pull/71/head
Miguel Mota 4 years ago
parent c16fc03120
commit 10c3f8d7f7

@ -66,6 +66,7 @@ func (s *Server) ListenAndServe() error {
Addr: fmt.Sprintf("%s:%v", s.address, s.port),
IdleTimeout: s.idleTimeout,
Handler: func(sshSession ssh.Session) {
userCmd := sshSession.Command()
ptyReq, winCh, isPty := sshSession.Pty()
if !isPty {
io.WriteString(sshSession, "Error: Non-interactive terminals are not supported")
@ -84,7 +85,24 @@ func (s *Server) ListenAndServe() error {
cmdCtx, cancelCmd := context.WithCancel(sshSession.Context())
defer cancelCmd()
cmd := exec.CommandContext(cmdCtx, s.executableBinary, "--reset", "--silent", "--cache-dir", tempDir, "--config", configPath)
flags := []string{
"--reset",
"--silent",
"--cache-dir",
tempDir,
"--config",
configPath,
}
for _, arg := range userCmd {
if arg == "cointop" {
continue
}
flags = append(flags, arg)
}
cmd := exec.CommandContext(cmdCtx, s.executableBinary, flags...)
cmd.Env = append(sshSession.Environ(), fmt.Sprintf("TERM=%s", ptyReq.Term))
f, err := pty.Start(cmd)

Loading…
Cancel
Save