You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes the regression introduced in PR #162 where complex multi-line bash
scripts with conditionals would fail with exit code 2.
## Problem
The original implementation wrapped commands using `JSON.stringify`,
which converted newlines to literal `\n` strings:
```bash
nice -n 19 bash -c "if [ \0 -ne 0 ]; then\n echo \"test\"\nfi"
```
This broke bash syntax, causing scripts with conditionals and multi-line
logic to fail.
## Solution
Spawn `nice` directly with proper arguments array instead of string
wrapping:
```typescript
spawn("nice", ["-n", "19", "bash", "-c", script], ...)
```
This avoids all escaping issues while maintaining the same niceness
functionality.
## Testing
Added comprehensive test coverage:
- ✅ Complex multi-line scripts with conditionals (reproduces the git
status regression)
- ✅ Exit code handling with niceness
- ✅ Simple commands with niceness
All 36 tests pass including the new niceness test suite.
_Generated with `cmux`_
0 commit comments