Skip to content

Commit

Permalink
Use resolved definition for custom execution (microsoft#2250)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored and Dmarch28 committed Mar 4, 2021
1 parent 0311c25 commit 5daf9df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,7 @@
}
},
"engines": {
"vscode": "^1.44.0"
"vscode": "^1.49.0"
},
"scripts": {
"watch": "tsc -watch -p ./",
Expand Down Expand Up @@ -2735,7 +2735,7 @@
"@types/semver": "^7.3.3",
"@types/string-replace-webpack-plugin": "^0.1.0",
"@types/tar": "^4.0.3",
"@types/vscode": "1.44.0",
"@types/vscode": "1.49.0",
"@types/xml2js": "^0.4.5",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/eslint-plugin-tslint": "^3.10.1",
Expand Down
10 changes: 6 additions & 4 deletions src/tasks/DockerPseudoterminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { CancellationToken, CancellationTokenSource, Event, EventEmitter, Pseudo
import { CommandLineBuilder } from '../utils/commandLineBuilder';
import { resolveVariables } from '../utils/resolveVariables';
import { spawnAsync } from '../utils/spawnAsync';
import { DockerBuildTask } from './DockerBuildTaskProvider';
import { DockerRunTask } from './DockerRunTaskProvider';
import { DockerBuildTask, DockerBuildTaskDefinition } from './DockerBuildTaskProvider';
import { DockerRunTask, DockerRunTaskDefinition } from './DockerRunTaskProvider';
import { DockerTaskProvider } from './DockerTaskProvider';
import { DockerTaskExecutionContext } from './TaskHelper';

Expand All @@ -27,7 +27,7 @@ export class DockerPseudoterminal implements Pseudoterminal {
/* eslint-disable-next-line no-invalid-this */
public readonly onDidClose: Event<number> = this.closeEmitter.event;

public constructor(private readonly taskProvider: DockerTaskProvider, private readonly task: DockerBuildTask | DockerRunTask) { }
public constructor(private readonly taskProvider: DockerTaskProvider, private readonly task: DockerBuildTask | DockerRunTask, private readonly resolvedDefinition: DockerBuildTaskDefinition | DockerRunTaskDefinition) { }

public open(initialDimensions: TerminalDimensions | undefined): void {
const folder = this.task.scope === TaskScope.Workspace
Expand All @@ -38,7 +38,9 @@ export class DockerPseudoterminal implements Pseudoterminal {
folder,
cancellationToken: this.cts.token,
terminal: this,
}
};

this.task.definition = this.resolvedDefinition;

// We intentionally don't have an error handler in the then() below. DockerTaskProvider.executeTask() cannot throw--errors will be caught and some nonzero integer returned.
// Can't wait here
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/DockerTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { CancellationToken, CustomExecution, ProviderResult, Task, TaskProvider } from 'vscode';
import { CancellationToken, CustomExecution, ProviderResult, Task, TaskDefinition, TaskProvider } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext, parseError } from 'vscode-azureextensionui';
import { DockerOrchestration } from '../constants';
import { DockerPlatform, getPlatform } from '../debugging/DockerPlatformHelper';
Expand All @@ -30,7 +30,7 @@ export abstract class DockerTaskProvider implements TaskProvider {
task.scope,
task.name,
task.source,
new CustomExecution(async () => Promise.resolve(new DockerPseudoterminal(this, task))),
new CustomExecution(async (resolvedDefinition: TaskDefinition) => Promise.resolve(new DockerPseudoterminal(this, task, resolvedDefinition))),
task.problemMatchers
);
}
Expand Down

0 comments on commit 5daf9df

Please sign in to comment.