fix(criteria,engine): route shell commands through shellexec, not direct sh -c#69
Merged
Merged
Conversation
…ect sh -c
criteria/db.go (evaluateMigrationSucceeds) and engine/investigator.go
(runCommand) both shelled out via exec.CommandContext(ctx, "sh", "-c",
cmd). On native Windows `sh` is not on PATH, so both paths silently
broke even for read-only commands the doctor / status / report commands
indirectly invoke. shellexec already exists for exactly this — it picks
sh on Unix and cmd.exe on Windows, honouring the NXD_SHELL override.
Replace both with shellexec.CommandContext(ctx, cmd). No behaviour
change on Unix; Windows pipelines now use the configured shell.
These were the last two `exec.Command*("sh", ...)` direct invocations
outside internal/shellexec itself. Future regressions can be caught by
the existing grep-style audit.
Surfaced by the 2026-06-11 architecture audit (ARCH-H5).
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.
Summary
criteria/db.go(evaluateMigrationSucceeds) andengine/investigator.go(runCommand) both shelled out viaexec.CommandContext(ctx, "sh", "-c", cmd). On native Windowsshisn't on PATH, so both paths silently broke — even thoughshellexecexists for exactly this case (sh on Unix,cmd.exeon Windows,NXD_SHELLoverride).Changes
Replace both with
shellexec.CommandContext(ctx, cmd). No behavior change on Unix; Windows pipelines now use the configured shell.These were the last two
exec.Command*("sh", ...)direct invocations outsideinternal/shellexecitself.Test plan
go build ./...,go vet ./...,go test ./... -count=1 -timeout 240sall green locally.Audit traceability
Architecture finding ARCH-H5 (2026-06-11 sweep).