1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-03 12:41:41 +03:00
Files
lazygit/pkg/commands/oscommands/cmd_obj_runner_default.go
2025-07-10 12:20:11 +02:00

29 lines
599 B
Go

//go:build !windows
// +build !windows
package oscommands
import (
"fmt"
"os/exec"
"github.com/creack/pty"
)
// we define this separately for windows and non-windows given that windows does
// not have great PTY support and we need a PTY to handle a credential request
func (self *cmdObjRunner) getCmdHandlerPty(cmd *exec.Cmd) (*cmdHandler, error) {
ptmx, err := pty.Start(cmd)
if err != nil {
return nil, err
}
LogCmd(fmt.Sprintf("Started cmd: %s, pid: %d", cmd.Args, cmd.Process.Pid))
return &cmdHandler{
stdoutPipe: ptmx,
stdinPipe: ptmx,
close: ptmx.Close,
}, nil
}