fix: robust foreground detection for macOS and multiple bug fixes
- Use `ps -o stat=` to check process foreground state directly, fixing macOS where tmux pane_current_command reports "zsh" instead of the child process. Falls back to pane_current_command safely. - Fix print mode retry off-by-one (maxRetries=5 only gave 4 retries) - Fix sendKeys failure leaving state unupdated (tight error loop) - Validate customPatterns config entries (non-string/invalid regex crashed monitor) - Parse "resets in: N hours" format (was detected but not time-parsed) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,17 @@ describe('loadConfig', () => {
|
||||
assert.equal(config.pollIntervalSeconds, 5);
|
||||
} finally { await unlink(f); }
|
||||
});
|
||||
it('filters invalid customPatterns entries', async () => {
|
||||
const { writeFile, unlink } = await import('node:fs/promises');
|
||||
const { tmpdir } = await import('node:os');
|
||||
const { join } = await import('node:path');
|
||||
const f = join(tmpdir(), `car-test-${Date.now()}.json`);
|
||||
await writeFile(f, JSON.stringify({ customPatterns: ["valid", 42, null, "[invalid"] }));
|
||||
try {
|
||||
const config = await loadConfig(f);
|
||||
assert.deepEqual(config.customPatterns, ["valid"]);
|
||||
} finally { await unlink(f); }
|
||||
});
|
||||
it('rejects negative numbers and falls back to defaults', async () => {
|
||||
const { writeFile, unlink } = await import('node:fs/promises');
|
||||
const { tmpdir } = await import('node:os');
|
||||
|
||||
Reference in New Issue
Block a user