castle-web-cli 0.4.8 → 0.4.10
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/dist/serve.js +9 -1
- package/package.json +1 -1
package/dist/serve.js
CHANGED
|
@@ -210,9 +210,17 @@ async function serveDetached(projectDir, options) {
|
|
|
210
210
|
args.push('--host', options.host);
|
|
211
211
|
if (options.open)
|
|
212
212
|
args.push('--open');
|
|
213
|
+
// CASTLE_WEB_CLI_DETACH=1 → spawn as a new session leader (fully
|
|
214
|
+
// independent; survives caller). This is the eval-harness mode where the
|
|
215
|
+
// harness manages cleanup itself.
|
|
216
|
+
// Default → child stays in the caller's process group / session, so when
|
|
217
|
+
// the agent / shell that invoked `castle-web init` exits, SIGHUP reaches
|
|
218
|
+
// this serve and it dies with the session.
|
|
219
|
+
// `.unref()` is what lets the calling node process exit either way.
|
|
220
|
+
const fullDetach = process.env.CASTLE_WEB_CLI_DETACH === '1';
|
|
213
221
|
const child = spawn(process.execPath, [entry, ...args], {
|
|
214
222
|
cwd: projectDir,
|
|
215
|
-
detached:
|
|
223
|
+
detached: fullDetach,
|
|
216
224
|
stdio: ['ignore', logFd, logFd],
|
|
217
225
|
env: process.env,
|
|
218
226
|
});
|