Skip to content

Commit

Permalink
fixes #54397
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Dec 10, 2018
1 parent 5b1fb58 commit 12b6329
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ const DEBUG_FUNCTION_BREAKPOINTS_KEY = 'debug.functionbreakpoint';
const DEBUG_EXCEPTION_BREAKPOINTS_KEY = 'debug.exceptionbreakpoint';
const DEBUG_WATCH_EXPRESSIONS_KEY = 'debug.watchexpressions';

function once(kind: TaskEventKind, event: Event<TaskEvent>): Event<TaskEvent> {
function once(match: (e: TaskEvent) => boolean, event: Event<TaskEvent>): Event<TaskEvent> {
return (listener, thisArgs = null, disposables?) => {
const result = event(e => {
if (e.kind === kind) {
if (match(e)) {
result.dispose();
return listener.call(thisArgs, e);
}
Expand Down Expand Up @@ -718,14 +718,14 @@ export class DebugService implements IDebugService {
// task is already running - nothing to do.
return Promise.resolve(null);
}
once(TaskEventKind.Active, this.taskService.onDidStateChange)((taskEvent) => {
once(e => e.kind === TaskEventKind.Active && e.taskId === task._id, this.taskService.onDidStateChange)(() => {
// Task is active, so everything seems to be fine, no need to prompt after 10 seconds
// Use case being a slow running task should not be prompted even though it takes more than 10 seconds
taskStarted = true;
});
const taskPromise = this.taskService.run(task);
if (task.isBackground) {
return new Promise((c, e) => once(TaskEventKind.Inactive, this.taskService.onDidStateChange)(() => {
return new Promise((c, e) => once(e => e.kind === TaskEventKind.Inactive && e.taskId === task._id, this.taskService.onDidStateChange)(() => {
taskStarted = true;
c(null);
}));
Expand Down

0 comments on commit 12b6329

Please sign in to comment.