cli bug fix

master
兔子 4 years ago
parent a94fc8d19d
commit 5c2cce2da2

@ -45,6 +45,7 @@ func Command(command string, args ...string) (*StarCmd, error) {
shell.stdoutBuf = bytes.NewBuffer(make([]byte, 0)) shell.stdoutBuf = bytes.NewBuffer(make([]byte, 0))
shell.stderrBuf = bytes.NewBuffer(make([]byte, 0)) shell.stderrBuf = bytes.NewBuffer(make([]byte, 0))
shell.runningChan = make(chan int, 3) shell.runningChan = make(chan int, 3)
shell.stopctx, shell.stopctxfunc = context.WithCancel(context.Background())
cmd := exec.Command(command, args...) cmd := exec.Command(command, args...)
shell.CMD = cmd shell.CMD = cmd
shell.infile, err = shell.CMD.StdinPipe() shell.infile, err = shell.CMD.StdinPipe()

@ -162,10 +162,10 @@ func (starcli *StarCmd) Release() error {
if err := starcli.CMD.Start(); err != nil { if err := starcli.CMD.Start(); err != nil {
return err return err
} }
starcli.cmd.SysProcAttr = &syscall.SysProcAttr{ starcli.CMD.SysProcAttr = &syscall.SysProcAttr{
Setsid: true, Setsid: true,
} }
starcli.cmd.Process.Release() starcli.CMD.Process.Release()
return nil return nil
} }

Loading…
Cancel
Save