Skip to content

Commit

Permalink
Deprecate wait in JS SDK; Add .wait() in JS SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentaTomas committed Oct 13, 2023
1 parent 9a74b7e commit 2d7fef0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
18 changes: 16 additions & 2 deletions packages/js-sdk/src/session/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,20 @@ export class ProcessOutput {
* A process running in the environment.
*/
export class Process {
/**
* @deprecated use .wait() instead
*/
readonly finished: Promise<ProcessOutput>

constructor(
readonly processID: string,
private readonly session: SessionConnection,
private readonly triggerExit: () => void,
readonly finished: Promise<ProcessOutput>,
finished: Promise<ProcessOutput>,
readonly output: ProcessOutput,
) {}
) {
this.finished = finished
}

/**
* Kills the process.
Expand All @@ -113,6 +120,13 @@ export class Process {
}
}

/**
* Waits for the process to finish.
*/
async wait(): Promise<ProcessOutput> {
return this.finished
}

/**
* Sends data to the process stdin.
*
Expand Down
19 changes: 17 additions & 2 deletions packages/js-sdk/src/session/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,23 @@ export class TerminalOutput {

/**
* A terminal session running in the environment.
*
*/
export class Terminal {
/**
* @deprecated use .wait() instead
*/
readonly finished: Promise<TerminalOutput>

constructor(
readonly terminalID: string,
private readonly session: SessionConnection,
private readonly triggerExit: () => void,
readonly finished: Promise<TerminalOutput>,
finished: Promise<TerminalOutput>,
readonly output: TerminalOutput,
) {}
) {
this.finished = finished
}

get data() {
return this.output.data
Expand All @@ -44,6 +52,13 @@ export class Terminal {
}
}

/**
* Waits for the terminal to finish.
*/
async wait(): Promise<TerminalOutput> {
return this.finished
}

/**
* Sends data to the terminal standard input.
*
Expand Down

0 comments on commit 2d7fef0

Please sign in to comment.