Skip to content

fix(cli): stop editor descendants when project creation times out - #1215

Open
tuncaypeker wants to merge 1 commit into
IvanMurzak:mainfrom
tuncaypeker:fix/cli-create-project-process-tree
Open

tuncaypeker wants to merge 1 commit into
IvanMurzak:mainfrom
tuncaypeker:fix/cli-create-project-process-tree

Conversation

@tuncaypeker

Copy link
Copy Markdown
Contributor

runEditorCreateProject uses execFile's timeout, which kills only the editor parent. Processes it started continue running after the promise rejects. Reproduced on main (3681e35 / CLI 1.15.0) with a native Windows fixture that starts a worker: after the 1500 ms timeout, the worker was still alive and its heartbeat file kept changing.

Use spawn with a dedicated process group on POSIX, then invoke the existing cli-core process-tree stop helper before the parent disappears (taskkill /T /F on Windows, process-group kill on POSIX). Wait for the stop operation and process close before returning the timeout error. Reuse the existing exit cleanup hook, and remove the hook/timer after completion. Preserve editor arguments, failure-prefix/stderr diagnostics, and support for large stdout by discarding stdout rather than buffering it.

Validation:

  • Added three real-process cases: successful creation with a space-containing project path and over 1 MiB of stdout; nonzero exit with stderr; and a timeout that stops the descendant heartbeat (plus Windows PID liveness and exit-hook cleanup).
  • POSIX uses an executable shell shim; Windows compiles a small .NET Framework launcher around the same Node fixture. The Windows cases skip only if that compiler is absent. No Unity Editor or Unity Hub is involved.
  • Temporarily restoring main's implementation made the descendant test fail: the heartbeat advanced from 45 to 49 after the timeout returned. The other two cases passed. Restored the fix afterward.
  • Focused process/create-project suites: 23 passed, three existing POSIX-only Hub cases skipped on Windows. TypeScript build passed.
  • Full CLI suite: npm test -- --maxWorkers=1 --testTimeout=30000 — all 62 files passed, 942 tests passed, 15 skipped. The pretest TypeScript build passed.
  • The original Windows native-process reproduction after the fix returned its 1500 ms timeout with childStillAlive=false and childStillWriting=false. It ran with permissions for Windows process inspection/termination; the sandbox restricts those operations. Fixture workers are cleaned up after every test.
  • git diff --check passed.

Rebased onto d69d73a after validation; its changes did not touch the CLI. Also checked subsequent main changes through c17091c (#1213/#1214): they affect Unity RQL/screenshot code and fixtures, not this CLI path.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant