Repository navigation
fix(process-session): spawn the same command more than once - #80
Merged
Merged
Conversation
passcod
marked this pull request as ready for review
November 11, 2026 02:15
passcod
force-pushed
the
fix/process-session-respawn
branch
from
November 11, 2026 02:15
4de3e70 to
64abb09
Compare
A command keeps its pre_exec hooks and pre_spawn runs on every spawn, so a second spawn ran setsid() twice in the child, and the second call failed with EPERM. The hook now accepts EPERM when the child already leads its session.
passcod
force-pushed
the
fix/process-session-respawn
branch
from
November 11, 2026 02:15
64abb09 to
a64e7a9
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #80 +/- ##
==========================================
+ Coverage 84.22% 84.32% +0.09%
==========================================
Files 17 17
Lines 1268 1276 +8
==========================================
+ Hits 1068 1076 +8
Misses 200 200
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 A
CommandWrapkeeps its command across spawns and runs every wrapper'spre_spawnagain on each one.pre_execonly ever adds hooks, so a command withProcessSessionrunssetsid()once per spawn so far. On the second spawn, the second call fails withEPERMand the spawn errors out. This affects both frontends.The hook now treats
EPERMas success when the child already leads its session.ProcessSessionis a public unit struct, so it can't remember that it already installed its hook without a breaking change. That means hooks still pile up, one per spawn: the extra ones are cheap syscalls in the child, but a command reused very many times keeps growing its hook list.ResetSigmaskpiles up the same way, and its hooks were already harmless to repeat.Adds tests that spawn the same command twice with each Unix wrapper.