Skip to content

Commit 94ce4b1

Browse files
committed
Simplify terminal
1 parent 2e2a2be commit 94ce4b1

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/actions/TerminalAction.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export abstract class TerminalAction implements IAction {
1212

1313
public async run(params = this.params): Promise<string> {
1414
const terminal = this.terminalProvider.provideTerminal();
15-
terminal.setCmdArgs(CLI.getInterpolatedArgs(this.args, params));
16-
return await terminal.exec(this.workingFolder);
15+
return await terminal.exec(
16+
CLI.getInterpolatedArgs(this.args, params),
17+
this.workingFolder,
18+
);
1719
}
1820
}

src/terminal/Terminal.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class TerminalColors {
1414
}
1515

1616
export class Terminal implements vscode.Pseudoterminal {
17-
private cmdArgs: string[] = [];
1817
private cmd: ChildProcessWithoutNullStreams | undefined;
1918

2019
private readonly writeEmitter = new vscode.EventEmitter<string>();
@@ -35,20 +34,14 @@ export class Terminal implements vscode.Pseudoterminal {
3534

3635
public async close(): Promise<void> {}
3736

38-
public setCmdArgs(cmdArgs: string[]) {
39-
this.cmdArgs = cmdArgs;
40-
}
41-
42-
public async exec(cwd: string): Promise<string> {
37+
public async exec(cmdArgs: string[], cwd: string): Promise<string> {
4338
await this.waitForOpen.wait();
4439

4540
this.write(
46-
`${TerminalColors.blue}${this.cmdArgs.join(' ')}${
47-
TerminalColors.reset
48-
}\n`,
41+
`${TerminalColors.blue}${cmdArgs.join(' ')}${TerminalColors.reset}\n`,
4942
);
5043

51-
const { cmd, output } = this.cli.exec(this.cmdArgs, cwd, {
44+
const { cmd, output } = this.cli.exec(cmdArgs, cwd, {
5245
onStdOut: (buffer: string) => {
5346
this.write(CLI.removePrefixFromStdOut(buffer));
5447
},

0 commit comments

Comments
 (0)