2024-07-30 23:33:33 +08:00
|
|
|
import type { SysCallMapping } from "../../lib/plugos/system.ts";
|
|
|
|
import type { ShellResponse } from "../../type/rpc.ts";
|
|
|
|
import type { ShellBackend } from "../shell_backend.ts";
|
2023-12-17 22:25:44 +08:00
|
|
|
|
|
|
|
export function shellSyscalls(shellBackend: ShellBackend): SysCallMapping {
|
|
|
|
return {
|
|
|
|
"shell.run": (
|
|
|
|
_ctx,
|
|
|
|
cmd: string,
|
|
|
|
args: string[],
|
|
|
|
): Promise<ShellResponse> => {
|
|
|
|
return shellBackend.handle({ cmd, args });
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|