Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/tasks/DockerBuildTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class DockerBuildTaskProvider extends DockerTaskProvider {

const runner = context.terminal.getCommandRunner({
folder: context.folder,
rejectOnStderr: false,
token: context.cancellationToken,
});

Expand Down
1 change: 0 additions & 1 deletion src/tasks/DockerComposeTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export class DockerComposeTaskProvider extends DockerTaskProvider {

const runner = context.terminal.getCommandRunner({
folder: context.folder,
rejectOnStderr: false,
token: context.cancellationToken,
});

Expand Down
5 changes: 0 additions & 5 deletions src/tasks/DockerPseudoterminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ export class DockerPseudoterminal implements Pseudoterminal {
(output: string, err: boolean) => {
if (err) {
this.writeError(output);

if (options.rejectOnStderr) {
throw new Error(output);
}
} else {
this.writeOutput(output);
}
Expand All @@ -129,6 +125,5 @@ export class DockerPseudoterminal implements Pseudoterminal {
type ExecuteCommandInTerminalOptions = {
commandResponse: VoidCommandResponse | PromiseCommandResponse<unknown>;
folder: WorkspaceFolder;
rejectOnStderr?: boolean;
token?: CancellationToken;
};
1 change: 0 additions & 1 deletion src/tasks/DockerRunTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export class DockerRunTaskProvider extends DockerTaskProvider {

const runner = context.terminal.getCommandRunner({
folder: context.folder,
rejectOnStderr: true,
token: context.cancellationToken,
});

Expand Down
12 changes: 10 additions & 2 deletions src/utils/execAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@ export async function execAsync(command: string, options?: cp.ExecOptions & { st
if (progress) {
stdoutIntermediate = new stream.PassThrough();
stdoutIntermediate.on('data', (chunk: Buffer) => {
progress(bufferToString(chunk), false);
try {
Copy link
Collaborator Author

@bwateratmsft bwateratmsft Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A sort of defense-in-depth; in case progress() decides to throw, it shouldn't get thrown out of this callback handler. Same for below.

progress(bufferToString(chunk), false);
} catch {
// Best effort
}
});
stdoutIntermediate.pipe(stdoutFinal);

stderrIntermediate = new stream.PassThrough();
stderrIntermediate.on('data', (chunk: Buffer) => {
progress(bufferToString(chunk), true);
try {
progress(bufferToString(chunk), true);
} catch {
// Best effort
}
});
stderrIntermediate.pipe(stderrFinal);
}
Expand Down