Skip to content

Commit da518c9

Browse files
fix failing commands
1 parent 2284e39 commit da518c9

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/sessions/WebSocketSession/commands.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,25 @@ export class Commands {
6464
true
6565
);
6666

67+
if (shell.status === "ERROR" || shell.status === "KILLED") {
68+
throw new Error(`Failed to create shell: ${shell.buffer.join("\n")}`);
69+
}
70+
6771
const details = {
6872
type: "command",
6973
command,
7074
name: opts?.name,
7175
};
7276

73-
// Only way for us to differentiate between a command and a terminal
74-
this.pitcherClient.clients.shell.rename(
75-
shell.shellId,
76-
// We embed some details in the name to properly show the command that was run
77-
// , the name and that it is an actual command
78-
JSON.stringify(details)
79-
);
77+
if (shell.status !== "FINISHED") {
78+
// Only way for us to differentiate between a command and a terminal
79+
this.pitcherClient.clients.shell.rename(
80+
shell.shellId,
81+
// We embed some details in the name to properly show the command that was run
82+
// , the name and that it is an actual command
83+
JSON.stringify(details)
84+
);
85+
}
8086

8187
const cmd = new Command(
8288
this.pitcherClient,

0 commit comments

Comments
 (0)