process-api: ProcessBuilder and Process API module (pipe-buffer deadlock and its fixes, timeouts and process-tree kill, grandchild holding the pipe, environment/redirect/stdin, ProcessHandle, startPipeline, shell and option injection), ProcessRunner, 14 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b3W3uHbHAmM3orhn7b
This commit is contained in:
Ankur
2026-11-26 00:48:44 +05:30
co-authored by Claude Sonnet 5.5
parent 47e4ccbefa
commit a714780bca
21 changed files with 952 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
== 1. waitFor(timeout) returns false; it does NOT stop the process
waitFor(500ms) = false
still alive = true
destroy() then waitFor -> exit code 143 (128 + SIGTERM 15 = 143)
== 2. a shell command spawns a child; destroying the shell orphans it
descendants of the shell: 1 -> [/usr/bin/sleep]
shell dead, orphan alive = true <- leaked process
== 3. kill the tree: snapshot descendants first, then kill all
shell alive = false, former child alive = false
== 4. ProcessRunner with a deadline
timedOut=true exit=-1 stdout=started elapsed<2s=true
== 5. a background grandchild keeps the pipe open: readAllBytes() waits for IT
sh exited at once, but readAllBytes() took ~4s; got done|late|
== 6. ProcessRunner is not held hostage by the same command
exit=0 stdout=done| returned in under 2s: true (bounded by the 1s reader grace, not by the 4s grandchild)