Skip to content

fix: destructure stdout in Cron._readCrontab() - #679

Merged
avoidwork merged 2 commits into
mainfrom
fix/cron-readcrontab-object
Aug 2, 2026
Merged

fix: destructure stdout in Cron._readCrontab()#679
avoidwork merged 2 commits into
mainfrom
fix/cron-readcrontab-object

Conversation

@avoidwork

@avoidwork avoidwork commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Description

Fixed Cron._readCrontab() which was calling .trim() on the raw { stdout, stderr } object returned by runExec(), coercing it to [object Object] instead of extracting the stdout string. This caused every method that reads the crontab (add, remove, list, enable, disable, sync) to fail silently — add() would write [object Object] into the crontab block, wiping existing managed entries.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

Updated the mock in tests/unit/scheduler/cron.test.js to return { stdout, stderr } shape matching the real runExec() return value, ensuring the test reflects actual behavior.

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

@avoidwork avoidwork added the bug Something isn't working label Aug 2, 2026
@avoidwork avoidwork self-assigned this Aug 2, 2026
@avoidwork avoidwork added the bug Something isn't working label Aug 2, 2026
@avoidwork
avoidwork merged commit ebb38f4 into main Aug 2, 2026
2 checks passed
@avoidwork
avoidwork deleted the fix/cron-readcrontab-object branch August 2, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant