@wendongfly/myhi 1.0.102 → 1.0.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/daemon.js CHANGED
@@ -43,8 +43,9 @@ function startServer() {
43
43
  else if (msg?.type === 'restart') doRestart();
44
44
  });
45
45
 
46
+ const thisChild = child;
46
47
  child.on('exit', (code, signal) => {
47
- child = null;
48
+ if (child === thisChild) child = null; // 只清自己的引用
48
49
  if (restarting) return; // 主动重启,不自动恢复
49
50
 
50
51
  // 防止崩溃循环:10秒内连续崩溃超过5次则退出
@@ -68,15 +69,18 @@ function doRestart() {
68
69
  log('收到重启请求');
69
70
  restarting = true;
70
71
  if (child) {
71
- child.kill('SIGTERM');
72
- // 等子进程退出后重启
73
- child.on('exit', () => {
72
+ const oldChild = child;
73
+ child = null; // 清引用,防止 startServer 里的 exit handler 再次触发
74
+ // 等旧进程退出后启动新的
75
+ const onExit = () => {
74
76
  restarting = false;
75
77
  setTimeout(startServer, 500);
76
- });
78
+ };
79
+ oldChild.once('exit', onExit);
80
+ oldChild.kill('SIGTERM');
77
81
  // 5秒后强制杀
78
82
  setTimeout(() => {
79
- if (child) { try { child.kill('SIGKILL'); } catch {} }
83
+ try { oldChild.kill('SIGKILL'); } catch {}
80
84
  }, 5000);
81
85
  } else {
82
86
  restarting = false;
package/dist/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@wendongfly/myhi","version":"1.0.101","description":"Web-based terminal sharing with chat UI — control your terminal from phone via LAN/Tailscale","type":"module","main":"dist/index.js","bin":{"myhi":"bin/myhi.js"},"files":["bin/","dist/"],"scripts":{"start":"node dist/index.js","dev":"node --watch src/server.js","build":"node scripts/build.js","postinstall":"node -e \"try{require('fs').chmodSync(require('path').join(__dirname,'bin','myhi.js'),0o755)}catch(e){}\""},"keywords":["terminal","web-terminal","claude","claude-code","tailscale","pty","remote-terminal","chat-ui"],"author":"wendongfly","license":"MIT","repository":{"type":"git","url":""},"engines":{"node":">=18.0.0"},"dependencies":{"node-pty":"^1.0.0","socket.io-client":"^4.8.3"},"devDependencies":{"@vercel/ncc":"^0.38.4","esbuild":"^0.27.4","express":"^4.18.2","multer":"^2.1.1","qrcode":"^1.5.4","qrcode-terminal":"^0.12.0","socket.io":"^4.8.1","socket.io-client":"^4.8.3","terser":"^5.46.1","xterm":"^4.19.0","xterm-addon-fit":"^0.5.0","xterm-addon-web-links":"^0.6.0"}}
1
+ {"name":"@wendongfly/myhi","version":"1.0.102","description":"Web-based terminal sharing with chat UI — control your terminal from phone via LAN/Tailscale","type":"module","main":"dist/index.js","bin":{"myhi":"bin/myhi.js"},"files":["bin/","dist/"],"scripts":{"start":"node dist/index.js","dev":"node --watch src/server.js","build":"node scripts/build.js","postinstall":"node -e \"try{require('fs').chmodSync(require('path').join(__dirname,'bin','myhi.js'),0o755)}catch(e){}\""},"keywords":["terminal","web-terminal","claude","claude-code","tailscale","pty","remote-terminal","chat-ui"],"author":"wendongfly","license":"MIT","repository":{"type":"git","url":""},"engines":{"node":">=18.0.0"},"dependencies":{"node-pty":"^1.0.0","socket.io-client":"^4.8.3"},"devDependencies":{"@vercel/ncc":"^0.38.4","esbuild":"^0.27.4","express":"^4.18.2","multer":"^2.1.1","qrcode":"^1.5.4","qrcode-terminal":"^0.12.0","socket.io":"^4.8.1","socket.io-client":"^4.8.3","terser":"^5.46.1","xterm":"^4.19.0","xterm-addon-fit":"^0.5.0","xterm-addon-web-links":"^0.6.0"}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wendongfly/myhi",
3
- "version": "1.0.102",
3
+ "version": "1.0.103",
4
4
  "description": "Web-based terminal sharing with chat UI — control your terminal from phone via LAN/Tailscale",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",