Skip to content

fix: read powershell output as UTF-8, kill every tree member past a refusal, release despite a failed scan - #90

Merged
OhadC merged 1 commit into
mainfrom
os-encoding-kill-release
Nov 21, 2026
Merged

OhadC merged 1 commit into
mainfrom
os-encoding-kill-release

Conversation

@OhadC

@OhadC OhadC commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Closes #89

Summary

 OsCommand.powershell(script)
-  powershell.exe -Command <script>
+  powershell.exe -Command [Console]::OutputEncoding = UTF8 (no BOM); <script>
 killPosixTree(top)
-  for each member: kill, throw on first non-ESRCH   # rest never signalled
+  killEach(tree): kill every member, then throw first non-ESRCH
 killTrees
-  failure only if top still running
+  failure if top still running, or a member refused (EPERM)
 leeway release
   write registry
-  scan listeners            # throws → exit 1, no "released" line
-  print released + orphans
+  print released
+  scan listeners            # fails → stderr "could not check …", same line as move
+  print orphans

Evidence

  • Before: ProcessTree.rows on a process with héllo-שלום in its command line → h�llo-????
    After: reads a non-ASCII command line through powershell (win32, real process) passes
  • Before: killPosixTree stops at the first EPERM
    After: killEach unit test: pid 50 throws EPERM → 100, 50, 30 all signalled, EPERM thrown
  • Before: leeway release with an empty PATH → exit 1, no released line
    After: exit 0, stdout leeway: released …, stderr leeway: could not check … for servers still listening

pnpm verify green on Windows. Linux run via docker (no podman here): all green apart from src/vite.test.ts, which also fails in docker on main.

Merge Danger

Door: two-way

Blast Radius: small

Windows leeway list and port-holder lines change from garbled to correct. On a failed scan, release now exits 0 instead of 1. killEach is now public so the unit test can reach it, but it isn't in the package's exports.

@OhadC
OhadC merged commit 6ab6520 into main Nov 21, 2026
12 checks passed
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.

Garbled PowerShell output, kill stops at the first error, release fails after releasing

1 participant