Skip to content

Commit d33c86f

Browse files
Merge pull request #265 from EduardKrieger/bugfix/executeCommand
Bugfix/execute command
2 parents d258978 + 7af1d34 commit d33c86f

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

runners/console/index.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -456,25 +456,30 @@ export class Console extends Runner {
456456
runExecuteCommand(runCommand: RunCommand): RunResult {
457457
let result = new RunResult();
458458
result.returnCode = 0;
459-
let commandIndex;
459+
let commandIndex, process;
460460
if(runCommand.command.parameters[0] && runCommand.command.parameters[1]){
461461
commandIndex = this.platform == ConsolePlatform.LINUX ? 1 : 0;
462462
}
463463
else{
464464
throw new Error("You have to pass a command for Windows and Linux based OS");
465465
}
466466

467-
let exeCommand = (runCommand.command.parameters.length > 1 && runCommand.command.parameters[2].args)
467+
let exeCommand = (runCommand.command.parameters.length > 2 && runCommand.command.parameters[2].args)
468468
? runCommand.command.parameters[commandIndex]+ " " +runCommand.command.parameters[2].args.join(" ")
469469
: runCommand.command.parameters[commandIndex];
470470

471-
let dirPath = (runCommand.command.parameters.length > 1 && runCommand.command.parameters[2].dir)
471+
let dirPath = (runCommand.command.parameters.length > 2 && runCommand.command.parameters[2].dir)
472472
? path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[2].dir)
473473
: this.getVariable(this.WORKSPACE_DIRECTORY)
474474

475475
if(runCommand.command.parameters.length > 2 && runCommand.command.parameters[2].asynchronous){
476476
if(runCommand.command.parameters[3].port){
477-
let process = ConsoleUtils.executeCommandAsync(exeCommand, dirPath, result,this.env);
477+
if(exeCommand.substring(0,6).toLowerCase() == "devon "){
478+
process = ConsoleUtils.executeDevonCommandAsync(exeCommand.substring(6), dirPath, path.join(this.getWorkingDirectory(), "devonfw") ,result,this.env);
479+
}else{
480+
process = ConsoleUtils.executeCommandAsync(exeCommand, dirPath, result,this.env);
481+
}
482+
478483
if(process.pid) {
479484
this.asyncProcesses.push({ pid: process.pid, port: runCommand.command.parameters[3].port});
480485
}
@@ -483,12 +488,17 @@ export class Console extends Runner {
483488
throw new Error("Missing arguments for the command " + exeCommand + ". You have to specify a port for the server. For further information read the function documentation.");
484489
}
485490
}
486-
else ConsoleUtils.executeCommandSync(exeCommand, dirPath, result, this.env);
487-
491+
else{
492+
if(exeCommand.substring(0,6).toLowerCase() == "devon "){
493+
ConsoleUtils.executeDevonCommandSync(exeCommand.substring(6), dirPath, path.join(this.getWorkingDirectory(), "devonfw") ,result,this.env);
494+
}else{
495+
ConsoleUtils.executeCommandSync(exeCommand, dirPath, result, this.env);
496+
}
497+
}
498+
488499
return result;
489500
}
490501

491-
492502
async assertExecuteCommand(runCommand: RunCommand, result: RunResult){
493503
try{
494504
let assert = new Assertions()

0 commit comments

Comments
 (0)