2024-02-09 04:00:45 +08:00
|
|
|
import { syscall } from "../syscall.ts";
|
2022-04-01 23:07:08 +08:00
|
|
|
|
2024-08-07 19:27:25 +08:00
|
|
|
/**
|
|
|
|
* Runs a shell command.
|
|
|
|
* @param cmd the command to run
|
|
|
|
* @param args the arguments to pass to the command
|
|
|
|
* @returns the stdout, stderr, and exit code of the command
|
|
|
|
*/
|
2022-10-10 20:50:21 +08:00
|
|
|
export function run(
|
2022-04-01 23:07:08 +08:00
|
|
|
cmd: string,
|
2022-10-10 20:50:21 +08:00
|
|
|
args: string[],
|
2023-05-24 02:53:53 +08:00
|
|
|
): Promise<{ stdout: string; stderr: string; code: number }> {
|
2022-04-01 23:07:08 +08:00
|
|
|
return syscall("shell.run", cmd, args);
|
|
|
|
}
|