This commit is contained in:
Richard Willis 2019-11-07 20:27:14 +01:00
Родитель 514b3ce4b8
Коммит c4b8e999ad
1 изменённых файлов: 3 добавлений и 36 удалений

Просмотреть файл

@ -355,8 +355,7 @@ function spawn(
command: string,
args?: ReadonlyArray<string>,
options?: cp.ExecOptions,
outputChannel?: OutputChannel,
onProcessCreate?: (process: cp.ChildProcess) => void
outputChannel?: OutputChannel
): Promise<string> {
if (outputChannel) {
outputChannel.append(`Executing: ${command}\n`);
@ -375,9 +374,6 @@ function spawn(
);
}
});
if (onProcessCreate) {
onProcessCreate(child);
}
});
}
@ -400,38 +396,9 @@ function getTasksFromGradle(
args.push(tasksArgs);
}
const { fsPath: cwd } = folder.uri;
let process: cp.ChildProcess;
const promise = spawn(
command,
args,
{ cwd },
outputChannel,
_p => (process = _p)
return spawn(command, args, { cwd }, outputChannel).finally(() =>
statusBarItem.hide()
);
const showProgress = setTimeout(() => {
window.withProgress(
{
location: ProgressLocation.Notification,
title: 'Loading Gradle Tasks',
cancellable: true
},
(_, token) => {
token.onCancellationRequested(() => {
process.kill();
window.showInformationMessage(
'Operation cancelled. Try again using command "Gradle: Refresh Tasks"'
);
});
return promise;
}
);
}, 5000);
return promise.finally(() => {
clearTimeout(showProgress);
statusBarItem.hide();
});
}
async function getTasks(