fix: exec cwd, output trimming, and status line alignment

- Set cwd to config.getTargetDir() so commands like pwd/git run in the
  correct workspace directory
- Strip only trailing newline instead of trim() to preserve intentional
  leading/trailing whitespace in command output
- Match footer's marginLeft/marginRight on the status line row so it
  aligns with the rest of the footer content

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wenshao 2026-04-06 11:45:49 +08:00
parent 24251db4ef
commit 1a985bb02e
2 changed files with 6 additions and 4 deletions

View file

@ -166,12 +166,14 @@ export function useStatusLine(): {
const child = exec(
cmd,
{ timeout: 5000, maxBuffer: 1024 * 10 },
{ cwd: cfg.getTargetDir(), timeout: 5000, maxBuffer: 1024 * 10 },
(error, stdout) => {
if (gen !== generationRef.current) return; // stale
activeChildRef.current = undefined;
if (!error && stdout) {
setOutput(stdout.trim().split('\n')[0] || null);
// Strip only the trailing newline to preserve intentional whitespace.
const line = stdout.replace(/\r?\n$/, '').split(/\r?\n/, 1)[0];
setOutput(line || null);
} else {
setOutput(null);
}