From 5c085bc60cb19cd9c1a22d3bce168741803f61a5 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 29 May 2025 17:11:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E8=AE=BE=E7=BD=AE=E4=BB=A5=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B=E9=98=BB=E5=A1=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/cmd/cmd_session.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/framework/cmd/cmd_session.go b/src/framework/cmd/cmd_session.go index dfeb146c..40d9ee65 100644 --- a/src/framework/cmd/cmd_session.go +++ b/src/framework/cmd/cmd_session.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "os/exec" + "syscall" "github.com/creack/pty" ) @@ -12,7 +13,12 @@ import ( func NewClientSession(cols, rows int) (*LocalClientSession, error) { // Create arbitrary command. c := exec.Command("bash") - + // 为防止当前进程阻塞,设置为后台执行 + c.SysProcAttr = &syscall.SysProcAttr{ + HideWindow: true, // 隐藏窗口 + CreationFlags: syscall.CREATE_NEW_CONSOLE, // 创建新控制台 + NoInheritHandles: true, // 不继承句柄 + } // Start the command with a pty. ptmx, err := pty.StartWithSize(c, &pty.Winsize{ Rows: uint16(rows), // ws_row: Number of rows (in cells).