Repository navigation
PowerShell exit reporting: possible approaches and an offer to contribute #13
TheBearBoB
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I’d like your thoughts on how Ripple should handle PowerShell native-program exit reporting before I submit a proposed change.
The investigation used Ripple v0.14.1 source at
cd1ca32, Windows, and PowerShell 7.6.10. Testing covered bothencoded_scriptblockandtempfiledelivery.The following behavior was reproduced:
cmd.exe /d /c exit 23in separate requests can report the first failure as exit23and the repeated failure as generic exit1. The second request still reports failure, but loses the exact native exit code.cmd.exe /d /c exit 23; Write-Output 'after'can finish with overall success while omittingLastExit: 23, particularly when the previous native exit code was also23.Overall success after a later successful command is consistent with PowerShell’s behavior. The concern is preserving the separate native-exit information that Ripple intends to provide.
My understanding is that the current resolver relies on comparing exit-code values and inspecting command syntax. Those observations cannot always establish what actually executed. PowerShell’s final command status and persistent
$LASTEXITCODEvalue are not a complete execution history. Microsoft’s definitionsI see three possible directions:
Keep the current approach and document its limits.
Treat native-exit attribution as best effort, with clear documentation about repeated codes, wrappers, and other cases where information may be unavailable.
Make a bounded improvement within the existing architecture.
Improve multiline and repeated-code reporting, preserve the distinction between overall command status and native-exit diagnostics, and explicitly identify uncertainty where reliable attribution is unavailable. This would include targeted regression tests and preserve normal PowerShell behavior, including scripts that inspect or assign
$LASTEXITCODE.Explore complete automatic native-result tracking.
Observe actual native execution and completion rather than infer it afterward. This could require substantial changes to Ripple, additional support from PowerShell, or a different execution model. I’m including it for discussion, not presenting it as an established solution.
I’m using OpenAI Codex to investigate this, and I don’t have the coding experience to independently validate its conclusions. I’m therefore presenting option three as an open feasibility question. It may require substantial changes, and I haven’t established whether it’s possible within Ripple’s current design.
I’d appreciate your assessment of these options. If option two would be a useful contribution, I’d like to contribute an AI-assisted implementation and tests through a pull request.
All reactions