-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellRunner.js
More file actions
29 lines (27 loc) · 928 Bytes
/
ShellRunner.js
File metadata and controls
29 lines (27 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* @fileoverview ShellRunner facade - delegates to environment-specific implementation
*/
import ShellRunnerFactory from './src/infrastructure/factories/ShellRunnerFactory.js';
import { DEFAULT_COMMAND_TIMEOUT } from './src/ports/RunnerOptionsSchema.js';
/**
* ShellRunner provides a standard CommandRunner implementation.
* It automatically detects the environment (Node, Bun, Deno) and uses the appropriate adapter.
*/
export default class ShellRunner {
/**
* Executes a command.
* @param {Object} options
* @param {string} options.command
* @param {string[]} options.args
* @param {string} [options.cwd]
* @param {string|Uint8Array} [options.input]
* @returns {Promise<{stdout: string, stderr: string, code: number}>}
*/
static async run(options) {
const runner = ShellRunnerFactory.create();
return runner({
timeout: DEFAULT_COMMAND_TIMEOUT,
...options
});
}
}