fix: 添加后台执行设置以防止进程阻塞
This commit is contained in:
@@ -15,8 +15,7 @@ func NewClientSession(cols, rows int) (*LocalClientSession, error) {
|
|||||||
c := exec.Command("bash")
|
c := exec.Command("bash")
|
||||||
// 为防止当前进程阻塞,设置为后台执行
|
// 为防止当前进程阻塞,设置为后台执行
|
||||||
c.SysProcAttr = &syscall.SysProcAttr{
|
c.SysProcAttr = &syscall.SysProcAttr{
|
||||||
HideWindow: true, // 隐藏窗口
|
Setpgid: true, // 设置新进程组,确保安装进程与当前进程不在同一进程组
|
||||||
NoInheritHandles: true, // 不继承句柄
|
|
||||||
}
|
}
|
||||||
// Start the command with a pty.
|
// Start the command with a pty.
|
||||||
ptmx, err := pty.StartWithSize(c, &pty.Winsize{
|
ptmx, err := pty.StartWithSize(c, &pty.Winsize{
|
||||||
|
|||||||
Reference in New Issue
Block a user