(command: CommandDefinition)
| 627 | } |
| 628 | |
| 629 | const runShellCommand = async (command: CommandDefinition): Promise<number> => { |
| 630 | await recordRecentCommand(HISTORY_PATH, command.key, Date.now()) |
| 631 | |
| 632 | return new Promise<number>((resolve, reject) => { |
| 633 | const childProcess = spawn(command.command, { |
| 634 | cwd: ROOT_DIRECTORY, |
| 635 | shell: true, |
| 636 | stdio: 'inherit' |
| 637 | }) |
| 638 | |
| 639 | childProcess.on('error', reject) |
| 640 | childProcess.on('exit', (code, signal) => { |
| 641 | if (signal) { |
| 642 | resolve(1) |
| 643 | return |
| 644 | } |
| 645 | |
| 646 | resolve(code ?? 0) |
| 647 | }) |
| 648 | }) |
| 649 | } |
| 650 | |
| 651 | const printRecentCommands = async (): Promise<void> => { |
| 652 | const recentCommands = await readRecentCommands() |
no test coverage detected