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

wait for task system info before running any task #187069

Merged
merged 6 commits into from
Jul 5, 2023
Merged

Conversation

meganrogge
Copy link
Contributor

When I reproduce the issue, here's the output I see: #173384 (comment)

'Warning: {0} tasks are unavailable in the current environment.\n',

problemReporter.fatal(nls.localize('TaskSystem.workspaceFolderError', 'Workspace folder was undefined'));

and those lines are reached if we try to get the workspace tasks before this has happened

public registerTaskSystem(key: string, info: ITaskSystemInfo): void {
// Ideally the Web caller of registerRegisterTaskSystem would use the correct key.
// However, the caller doesn't know about the workspace folders at the time of the call, even though we know about them here.
if (info.platform === Platform.Platform.Web) {
key = this.workspaceFolders.length ? this.workspaceFolders[0].uri.scheme : key;
}
if (!this._taskSystemInfos.has(key)) {
this._taskSystemInfos.set(key, [info]);
} else {

so we now will do for runTask, runBuildTask, and reconnectTasks what runAutomaticTasks does to avoid such issues

// Wait until we have task system info (the extension host and workspace folders are available).
if (!this._taskService.hasTaskSystemInfo) {
this._logService.trace('RunAutomaticTasks: Awaiting task system info.');
await Event.toPromise(Event.once(this._taskService.onDidChangeTaskSystemInfo));
}

fix #173384

@meganrogge meganrogge requested a review from Tyriar July 5, 2023 17:50
@meganrogge meganrogge self-assigned this Jul 5, 2023
@meganrogge meganrogge added this to the July 2023 milestone Jul 5, 2023
@meganrogge meganrogge requested a review from Tyriar July 5, 2023 18:24
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
@meganrogge meganrogge enabled auto-merge July 5, 2023 18:48
@meganrogge meganrogge requested a review from Tyriar July 5, 2023 18:48
@meganrogge meganrogge merged commit bbed10d into main Jul 5, 2023
6 checks passed
@meganrogge meganrogge deleted the merogge/task-build branch July 5, 2023 19:49
@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build task not found sometimes
2 participants