Fix trace command cwd handling on Windows
Summary
- remove the inline
cd ...;wrapper from the trace command - run the configured trace command with
spawnusingcwdinstead - add shell quoting helpers and tests for Windows/POSIX trace directory substitution
Why
This addresses #48. On Windows, cd without /d cannot switch drives, so a project on P: launched from a storage path on C: fails before tsc --generateTrace runs. Passing the project path through spawn({ cwd }) avoids embedding a drive-changing cd in the shell command.
Verification
pnpm lintpnpm typecheckpnpm exec vitest runpnpm build
Maintainer ping: PR #77 looks like the right fix for issue #48 (Windows cross-drive failure) by using instead of an inline wrapper.
FYI: currently reports no checks on the branch and the PR shows . If that’s just because CI isn’t running on forks / needs manual approval, could you trigger CI (or confirm the expected check suite) and merge if it’s green?
Correction (shell ate backticks in my prior comment):
- Issue: Windows cross-drive
cdfails when the command is wrapped as(cd <path>; <cmd>). - Fix idea in #77: use
spawn(..., { cwd: <path> })(or equivalent) so we don't rely on shellcd.
Also: gh pr checks currently reports "no checks" on the branch and the PR shows mergeStateStatus=UNSTABLE, so it may need a maintainer-triggered CI run / fork approval gate.
Nice fix — removing the inline (cd ...; ...) wrapper and relying on spawn({ cwd }) is the right way to avoid Windows cross-drive cd semantics.
One small thought: shell: process.env.SHELL || true can reintroduce quoting mismatches on Windows if SHELL is set to Git-Bash (POSIX quoting) while quoteShellArg(..., platform) stays win32 (double-quote) semantics. If you don’t need a user-selected shell here, shell: true (platform default) might be safer/deterministic.
Otherwise createTraceCommand + the new tests look solid.
One extra merge-safety thought: the quoting strategy and shell selection should stay aligned.
Right now createTraceCommand(...) quotes based on process.platform, but the spawn call uses shell: process.env.SHELL || true. On Windows setups launched from Git Bash / MSYS, that can mean win32-style quoting is handed to a POSIX shell.
Low-risk options:
- use
shell: trueso the platform-default shell matches the platform-specific quoting logic, or - make the quoting strategy depend on the actual shell being used, not just
process.platform.
If you keep the current shape, one focused regression test around a Windows path with spaces while SHELL is set to a POSIX shell would help confirm the command still executes as intended.