File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ async function main() {
6666
6767 const instance = await sandbox .create ();
6868
69- const process4 = await instance .exec (" sh" , " -c" , " cd /app && node server.js" );
69+ const process4 = await instance .exec ([ " sh" , " -c" , " cd /app && node server.js" ] );
7070
7171 const url = await instance .exposePort (3000 );
7272 console .log (` Server is running at ${url } ` );
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import type {
1212 PodSandboxCreateDirectoryResponse ,
1313 PodSandboxListUrlsResponse ,
1414 PodInstanceData ,
15+ ExecOptions ,
1516} from "../../types/pod" ;
1617import beamClient from "../.." ;
1718
@@ -430,8 +431,12 @@ export class SandboxInstance extends PodInstance {
430431 }
431432
432433 /** Run an arbitrary command in the sandbox. */
433- public async exec ( ...args : string [ ] ) : Promise < SandboxProcess > {
434- return this . _exec ( args ) ;
434+ public async exec (
435+ command : string | string [ ] ,
436+ opts ?: ExecOptions
437+ ) : Promise < SandboxProcess > {
438+ const commandList = Array . isArray ( command ) ? command : [ command ] ;
439+ return this . _exec ( commandList , opts ) ;
435440 }
436441
437442 private async _exec (
Original file line number Diff line number Diff line change @@ -299,4 +299,9 @@ export interface PodSandboxCreateImageFromFilesystemResponse {
299299 imageId : string ;
300300}
301301
302+ export interface ExecOptions {
303+ cwd ?: string ;
304+ env ?: Record < string , string > ;
305+ }
306+
302307// Store requests here?
You can’t perform that action at this time.
0 commit comments