@pikibun/tui 0.39.0 → 0.41.0

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.
@@ -102,14 +102,15 @@ async function main(args, root) {
102
102
  `);
103
103
  return 1;
104
104
  }
105
- const child = spawn(found.path, hostArguments(args, path.join(root, "app", "bundle.js"), log), { stdio: "inherit" });
105
+ const ownSession = hostInOwnSession();
106
+ const child = spawn(found.path, hostArguments(args, path.join(root, "app", "bundle.js"), log), { stdio: "inherit", detached: ownSession });
106
107
  const ignore = () => {
107
108
  };
108
109
  const forward = (signal) => () => {
109
110
  child.kill(signal);
110
111
  };
111
- const forwarded = ["SIGTERM", "SIGHUP"].map((signal) => [signal, forward(signal)]);
112
- process.on("SIGINT", ignore);
112
+ const forwarded = forwardedSignals(ownSession).map((signal) => [signal, forward(signal)]);
113
+ if (!ownSession) process.on("SIGINT", ignore);
113
114
  for (const [signal, handler] of forwarded) process.on(signal, handler);
114
115
  try {
115
116
  return await new Promise((resolve) => {
@@ -125,6 +126,12 @@ async function main(args, root) {
125
126
  for (const [signal, handler] of forwarded) process.off(signal, handler);
126
127
  }
127
128
  }
129
+ function hostInOwnSession(platform = process.platform) {
130
+ return platform !== "win32";
131
+ }
132
+ function forwardedSignals(ownSession) {
133
+ return ownSession ? ["SIGTERM", "SIGHUP", "SIGINT", "SIGWINCH"] : ["SIGTERM", "SIGHUP"];
134
+ }
128
135
 
129
136
  // packages/tui/src/bin.ts
130
137
  process.exitCode = await main(process.argv.slice(2), path2.dirname(path2.dirname(fileURLToPath(import.meta.url))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikibun/tui",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Pikibun in your terminal: the Pikibun app, drawn in the terminal by Native Shell.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://pikibun.com",
@@ -30,11 +30,11 @@
30
30
  "node": ">=18"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@pikibun/tui-linux-x64": "0.39.0",
34
- "@pikibun/tui-linux-arm64": "0.39.0",
35
- "@pikibun/tui-darwin-arm64": "0.39.0",
36
- "@pikibun/tui-darwin-x64": "0.39.0",
37
- "@pikibun/tui-win32-x64": "0.39.0",
38
- "@pikibun/tui-win32-arm64": "0.39.0"
33
+ "@pikibun/tui-linux-x64": "0.41.0",
34
+ "@pikibun/tui-linux-arm64": "0.41.0",
35
+ "@pikibun/tui-darwin-arm64": "0.41.0",
36
+ "@pikibun/tui-darwin-x64": "0.41.0",
37
+ "@pikibun/tui-win32-x64": "0.41.0",
38
+ "@pikibun/tui-win32-arm64": "0.41.0"
39
39
  }
40
40
  }