castle-web-cli 0.4.9 → 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.
Files changed (2) hide show
  1. package/dist/serve.js +8 -3
  2. package/package.json +1 -1
package/dist/serve.js CHANGED
@@ -210,12 +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
- // We stay in the parent's process group (no detached: true) so that when
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
214
217
  // the agent / shell that invoked `castle-web init` exits, SIGHUP reaches
215
- // this serve and it dies with the session. The `.unref()` is what lets
216
- // the calling node process exit while the serve keeps running until then.
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';
217
221
  const child = spawn(process.execPath, [entry, ...args], {
218
222
  cwd: projectDir,
223
+ detached: fullDetach,
219
224
  stdio: ['ignore', logFd, logFd],
220
225
  env: process.env,
221
226
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "castle-web-cli",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "castle-web": "./dist/index.js"