Skip to content

Commit 920acd6

Browse files
changed executeCommand in katacoda runner
1 parent 6df6907 commit 920acd6

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

runners/katacoda/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,15 @@ export class Katacoda extends Runner {
407407
? this.getTerminal("executeCommand" + runCommand.stepIndex)
408408
: undefined;
409409

410-
let cdCommand: string = undefined;
411-
if(runCommand.command.parameters.length > 2 && runCommand.command.parameters[2].dir){
410+
let cdCommand: string;
411+
if(runCommand.command.parameters.length > 2 && runCommand.command.parameters[2].dir) {
412412
cdCommand = terminal
413413
? this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[2].dir), terminal.terminalId, terminal.isRunning)
414414
: this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[2].dir));
415+
} else {
416+
cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY)));
415417
}
416-
418+
417419
let bashCommand = {
418420
"name" : runCommand.command.parameters[1],
419421
"terminalId" : terminal ? terminal.terminalId : 1,

runners/katacoda/templates/executeCommand.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
<%= cdCommand; %>
44

55
<% if(bashCommand.interrupt) { %>
6-
<% if(bashCommand.cdCommand) { %>
7-
Run `<%= bashCommand.name; %>` with this command.`<%= bashCommand.name; %> <%= bashCommand.args; %>`{{execute T<%= bashCommand.terminalId; %>}}
8-
<% } else { %>
96
Some command is already running in terminal <%= bashCommand.terminalId; %>. Rerun the command to stop and relaunch it automatically. `<%= bashCommand.name; %> <%= bashCommand.args; %>`{{execute T<%= bashCommand.terminalId; %> interrupt }}
10-
<% } }else { %>
7+
<% } else { %>
118
Run `<%= bashCommand.name; %>` with this command.
129
`<%= bashCommand.name; %> <%= bashCommand.args; %>`{{execute T<%= bashCommand.terminalId; %>}}
1310
<% } %>

0 commit comments

Comments
 (0)