(command, args)
| 58 | } |
| 59 | |
| 60 | function runCommand(command, args) { |
| 61 | const result = spawnSync(command, args, { |
| 62 | encoding: 'utf8', |
| 63 | stdio: 'pipe', |
| 64 | shell: process.platform === 'win32' |
| 65 | }); |
| 66 | |
| 67 | if (result.status !== 0) { |
| 68 | throw new Error(`${command} failed: ${result.stderr || result.stdout || 'Unknown error'}`); |
| 69 | } |
| 70 | |
| 71 | return result.stdout; |
| 72 | } |
| 73 | |
| 74 | async function pruneBackups(backupDir, retentionDays) { |
| 75 | if (!Number.isFinite(retentionDays) || retentionDays <= 0) { |