MCPcopy Create free account
hub / github.com/Sandpack/nodebox-runtime / runCommand

Method runCommand

packages/nodebox/src/modules/shell.ts:91–102  ·  view source on GitHub ↗

* Evaluates a given module in the File

(command: string, args: Array<string>, options: ShellCommandOptions = {})

Source from the content-addressed store, hash-verified

89 * Evaluates a given module in the File
90 */
91 public async runCommand(command: string, args: Array<string>, options: ShellCommandOptions = {}): Promise<ShellInfo> {
92 invariant(!this.id, 'Failed to run "runCommand" on a ShellProcess: there is already a process running.');
93
94 const shellInfo = await this.channel.send('shell/runCommand', { command, args, options });
95
96 invariant(shellInfo, 'Failed to run "runCommand" on a ShellProcess: was not able to retrieve a running process.');
97
98 this.id = shellInfo.id;
99 this.state = 'running';
100
101 return shellInfo;
102 }
103
104 public async on(message: 'exit', listener: (exitCode: number, error?: { message: string }) => void): Promise<void>;
105 public async on(message: 'progress', listener: (status: WorkerStatusUpdate) => void): Promise<void>;

Callers 15

startPreviewFunction · 0.80
console.test.tsFile · 0.80
nuxt.example.jsFile · 0.80
astro.example.jsFile · 0.80
fooFunction · 0.80
nodemon.example.jsFile · 0.80

Calls 1

sendMethod · 0.45

Tested by 1

startPreviewFunction · 0.64