update
This commit is contained in:
26
ts/cli/commands/batch/stop-all.ts
Normal file
26
ts/cli/commands/batch/stop-all.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import { tspmIpcClient } from '../../../classes.ipcclient.js';
|
||||
import type { CliArguments } from '../../types.js';
|
||||
import { registerIpcCommand } from '../../registration/index.js';
|
||||
|
||||
export function registerStopAllCommand(smartcli: plugins.smartcli.Smartcli) {
|
||||
registerIpcCommand(smartcli, 'stop-all', async (_argvArg: CliArguments) => {
|
||||
console.log('Stopping all processes...');
|
||||
const response = await tspmIpcClient.request('stopAll', {});
|
||||
|
||||
if (response.stopped.length > 0) {
|
||||
console.log(`✓ Stopped ${response.stopped.length} processes:`);
|
||||
for (const id of response.stopped) {
|
||||
console.log(` - ${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (response.failed.length > 0) {
|
||||
console.log(`✗ Failed to stop ${response.failed.length} processes:`);
|
||||
for (const failure of response.failed) {
|
||||
console.log(` - ${failure.id}: ${failure.error}`);
|
||||
}
|
||||
process.exitCode = 1; // Signal partial failure
|
||||
}
|
||||
}, { actionLabel: 'stop all processes' });
|
||||
}
|
Reference in New Issue
Block a user