Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use resolved definition for custom execution #2250

Merged
merged 4 commits into from
Sep 11, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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",
bwateratmsft marked this conversation as resolved.
Show resolved Hide resolved
"@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