Linux 可以用 sh -c 启动新进程 并用进程组管理进程 Windows 用 cmd /c 不方便管理新进程 改用 exec.Command(exe, args...)

纯记录笔记

Linux 可以用 sh -c "command"启动新进程, 再用进程组进行管理.
示例代码 https://github.com/crazypeace/my-dream-proxy-client/blob/main/process_unix.go

Windows 有类似的启动方式 cmd /c "command", 但是没有方便的进程组.
只能用 Job Object(作业对象), 代码一下子要加很多.
我考虑到 翻墙客户端(壳) 启动的 xray子进程 并不会启动孙子进程. 
所以就先把 "command" 分解为 exe 和 args, 然后 exec.Command(exe, args...)


评论

The Hot3 in Last 7 Days

丐版VPS 搭酒馆SillyTavern 白嫖Google Gemini免费API 和AI对话第一个故事

酒馆SillyTavern 玩英文角色卡 也能以中文输出 设置世界书Lorebooks