@gjsify/child_process 0.64.30 → 0.64.32

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.
@@ -1 +1 @@
1
- import{__exportAll as e}from"../_virtual/_rolldown/runtime.js";import{COMMON_SIGNALS as t,applyArgv0 as n,defaultShell as r,detachedPrefix as i,killProcess as a,shellArgv as o}from"./posix.js";var s=e({SIGNALS:()=>c,applyArgv0:()=>n,defaultShell:()=>r,detachedPrefix:()=>i,killProcess:()=>killProcess,shellArgv:()=>o});const c=Object.freeze({...t,SIGEMT:7,SIGBUS:10,SIGSYS:12,SIGURG:16,SIGSTOP:17,SIGTSTP:18,SIGCONT:19,SIGCHLD:20,SIGTTIN:21,SIGTTOU:22,SIGIO:23,SIGUSR1:30,SIGUSR2:31});function killProcess(e,t){a(e,t,c)}export{c as SIGNALS,n as applyArgv0,s as darwin_exports,r as defaultShell,i as detachedPrefix,killProcess,o as shellArgv};
1
+ import{__exportAll as e}from"../_virtual/_rolldown/runtime.js";import{COMMON_SIGNALS as t,applyArgv0 as n,defaultShell as r,killProcess as i,shellArgv as a}from"./posix.js";import o from"@girs/glib-2.0";var s=e({SIGNALS:()=>l,applyArgv0:()=>n,defaultShell:()=>r,detachedPrefix:()=>detachedPrefix,killProcess:()=>killProcess,shellArgv:()=>a});let c;function detachedPrefix(){if(c===void 0){let e=o.find_program_in_path(`setsid`);c=e===null?o.file_test(`/usr/bin/perl`,o.FileTest.IS_EXECUTABLE)?[`/usr/bin/perl`,`-e`,`use POSIX (); POSIX::setsid(); exec { $ARGV[0] } @ARGV or die "exec: $!"`,`--`]:null:[e]}return c}const l=Object.freeze({...t,SIGEMT:7,SIGBUS:10,SIGSYS:12,SIGURG:16,SIGSTOP:17,SIGTSTP:18,SIGCONT:19,SIGCHLD:20,SIGTTIN:21,SIGTTOU:22,SIGIO:23,SIGUSR1:30,SIGUSR2:31});function killProcess(e,t){i(e,t,l)}export{l as SIGNALS,n as applyArgv0,s as darwin_exports,r as defaultShell,detachedPrefix,killProcess,a as shellArgv};
@@ -1,5 +1,17 @@
1
1
  import type Gio from '@girs/gio-2.0';
2
- export { applyArgv0, defaultShell, detachedPrefix, shellArgv } from './posix.js';
2
+ export { applyArgv0, defaultShell, shellArgv } from './posix.js';
3
+ /**
4
+ * argv prefix that promotes the child to a new session / process-group leader
5
+ * (Node's `detached: true`), or `null` when no helper exists here.
6
+ *
7
+ * `setsid(2)` itself is unreachable from JS because
8
+ * `g_subprocess_launcher_set_child_setup()` is hidden from GIR. On Linux we
9
+ * shell out to `setsid(1)` from PATH; on stock macOS that binary is absent, so
10
+ * we use the Perl one-liner that ships with the OS. Perl calls `setsid()` and
11
+ * then replaces itself with the target program via `exec`, so the pid we
12
+ * capture at spawn time is the pid of the session leader.
13
+ */
14
+ export declare function detachedPrefix(): string[] | null;
3
15
  /**
4
16
  * macOS / BSD signal numbers (`/usr/include/sys/signal.h`). Note how far these
5
17
  * drift from Linux: `SIGUSR1` is 30 here but 10 on Linux, `SIGSTOP` is 17 here
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/child_process",
3
- "version": "0.64.30",
3
+ "version": "0.64.32",
4
4
  "description": "Node.js child_process module for Gjs",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -38,20 +38,20 @@
38
38
  "child_process"
39
39
  ],
40
40
  "devDependencies": {
41
- "@gjsify/cli": "^0.64.30",
42
- "@gjsify/dom-elements": "^0.64.30",
43
- "@gjsify/unit": "^0.64.30",
41
+ "@gjsify/cli": "^0.64.32",
42
+ "@gjsify/dom-elements": "^0.64.32",
43
+ "@gjsify/unit": "^0.64.32",
44
44
  "@types/node": "^25.9.2",
45
45
  "typescript": "^6.0.3"
46
46
  },
47
47
  "dependencies": {
48
48
  "@girs/gio-2.0": "5.4.0",
49
49
  "@girs/glib-2.0": "5.4.0",
50
- "@gjsify/buffer": "^0.64.30",
51
- "@gjsify/events": "^0.64.30",
52
- "@gjsify/ipc-channel": "^0.64.30",
53
- "@gjsify/sab-native": "^0.64.30",
54
- "@gjsify/utils": "^0.64.30"
50
+ "@gjsify/buffer": "^0.64.32",
51
+ "@gjsify/events": "^0.64.32",
52
+ "@gjsify/ipc-channel": "^0.64.32",
53
+ "@gjsify/sab-native": "^0.64.32",
54
+ "@gjsify/utils": "^0.64.32"
55
55
  },
56
56
  "gjsify": {
57
57
  "runtimes": {
@@ -67,7 +67,7 @@
67
67
  "win32": "partial"
68
68
  },
69
69
  "osNotes": {
70
- "darwin": "`detached: true` degrades. macOS ships no `setsid(1)` (it is a util-linux tool) and `setsid(2)` is unreachable from JS because `g_subprocess_launcher_set_child_setup()` is not introspectable, so `detachedPrefix()` returns `null` unless the user installed one. The child is still spawned and still outlives its parent, but it stays in the parent's process group, so terminal-generated SIGINT/SIGHUP still reach it — see `src/platform/darwin.ts`. Everything else in the package is exercised on darwin by `macos-suites.yml`, including the BSD signal table and the in-process `communicate.ts` timeout that replaced GNU `timeout(1)` for this platform.",
70
+ "darwin": "`detached: true` works on macOS via a fallback. macOS ships no `setsid(1)` (it is a util-linux tool) and `setsid(2)` is unreachable from JS because `g_subprocess_launcher_set_child_setup()` is not introspectable, so `detachedPrefix()` prefers `setsid` from PATH and otherwise falls back to `/usr/bin/perl` calling `POSIX::setsid()` followed by `exec`. The captured `child.pid` is therefore the session leader's pid and `process.kill(-pid)` reaches the whole process group. If neither helper is available the contract degrades to `null`: the child still spawns and still outlives its parent, but it stays in the parent's process group, so terminal-generated SIGINT/SIGHUP still reach it — see `src/platform/darwin.ts`. Everything else in the package is exercised on darwin by `macos-suites.yml`, including the BSD signal table and the in-process `communicate.ts` timeout that replaced GNU `timeout(1)` for this platform.",
71
71
  "win32": "A `src/platform/win32.ts` exists and is written against Node's documented Windows behaviour, but NOTHING RUNS IT. The package declares `runtimes.node: \"none\"`, so `test:node` exercises native Node rather than this implementation, and `test:gjs` — the leg that would measure it — cannot run on Windows at all because there is no GJS host there. The win32 module is therefore unexercised code, not a verified port. Promote to `supported` when a leg executes it."
72
72
  }
73
73
  },