Skip to content

Commit

Permalink
debug: do not run prelaunch and postdebug tasks for automtic restarts
Browse files Browse the repository at this point in the history
fixes #11522
  • Loading branch information
isidorn committed Mar 8, 2018
1 parent cebb2f3 commit c08e38d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class DebugService implements debug.IDebugService {
private breakpointsToSendOnResourceSaved: Set<string>;
private launchJsonChanged: boolean;
private firstSessionStart: boolean;
private skipRunningTask: boolean;
private previousState: debug.State;
private fetchThreadsSchedulers: Map<string, RunOnceScheduler>;

Expand Down Expand Up @@ -996,7 +997,8 @@ export class DebugService implements debug.IDebugService {
}

private runTask(sessionId: string, root: IWorkspaceFolder, taskName: string): TPromise<ITaskSummary> {
if (!taskName) {
if (!taskName || this.skipRunningTask) {
this.skipRunningTask = false;
return TPromise.as(null);
}

Expand Down Expand Up @@ -1065,6 +1067,8 @@ export class DebugService implements debug.IDebugService {
}
const focusedProcess = this.viewModel.focusedProcess;
const preserveFocus = focusedProcess && process.getId() === focusedProcess.getId();
// Do not run prelaunch and postdebug tasks for automtic restarts
this.skipRunningTask = !!restartData;

return process.session.disconnect(true).then(() => {
if (strings.equalsIgnoreCase(process.configuration.type, 'extensionHost') && process.session.root) {
Expand All @@ -1088,6 +1092,7 @@ export class DebugService implements debug.IDebugService {
config.noDebug = process.configuration.noDebug;
}
config.__restart = restartData;
this.skipRunningTask = !!restartData;
this.startDebugging(launch, config).then(() => c(null), err => e(err));
}, 300);
});
Expand Down

0 comments on commit c08e38d

Please sign in to comment.