Skip to content

Commit

Permalink
railsware#800: remove excessive logging from CommandExecutor
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed May 24, 2017
1 parent 86e0cbc commit 7e70656
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/shell/CommandExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,12 @@ class BuiltInCommandExecutionStrategy extends CommandExecutionStrategy {
}

startExecution() {
console.log('startExecution 1');
return new Promise((resolve, reject) => {
try {
console.log('startExecution 2');
Command.executor(this.job.prompt.commandName)(this.job, this.job.prompt.arguments.map(token => token.value));
console.log('startExecution 3');
resolve();
console.log('startExecution 4');
} catch (error) {
console.log('startExecution 5');
reject(error.message);
console.log('startExecution 6');
}
});
}
Expand All @@ -63,20 +57,14 @@ class ShellExecutionStrategy extends CommandExecutionStrategy {
}

startExecution() {
console.log('ShellExecutionStrategy.startExecution 1');
return new Promise((resolve, reject) => {
console.log('ShellExecutionStrategy.startExecution 2');
this.job.setPty(new PTY(
this.job.prompt.expandedTokens.map(token => token.escapedValue),
this.job.environment.toObject(),
this.job.dimensions,
(data: string) => {
console.log('ShellExecutionStrategy.startExecution 4');
this.job.parser.parse(data)
},
(data: string) => this.job.parser.parse(data),
(exitCode: number) => exitCode === 0 ? resolve() : reject(new NonZeroExitCodeError(exitCode.toString())),
));
console.log('ShellExecutionStrategy.startExecution 3');
});
}
}
Expand All @@ -87,9 +75,7 @@ class WindowsShellExecutionStrategy extends CommandExecutionStrategy {
}

startExecution() {
console.log('WindowsShellExecutionStrategy.startExecution 1');
return new Promise((resolve) => {
console.log('WindowsShellExecutionStrategy.startExecution 2');
this.job.setPty(new PTY(
[
this.cmdPath,
Expand Down Expand Up @@ -123,18 +109,11 @@ export class CommandExecutor {
];

static async execute(job: Job): Promise<{}> {
console.log('CommandExecutor.execute 1');
const applicableExecutors = await filterAsync(this.executors, executor => executor.canExecute(job));
console.log('CommandExecutor.execute 2');
console.log('applicableExecutors', applicableExecutors[0]);

if (applicableExecutors.length) {
console.log('CommandExecutor.execute 3');
const x = new applicableExecutors[0](job);
console.log('CommandExecutor.execute 3.1');
return x.startExecution();
return new applicableExecutors[0](job).startExecution();
} else {
console.log('CommandExecutor.execute 4');
throw `Black Screen: command "${job.prompt.commandName}" not found.\n`;
}
}
Expand Down

0 comments on commit 7e70656

Please sign in to comment.