returnthis.textFileService.saveAll().then((value)=>{// make sure all dirty files are saved
returnthis.configurationService.reloadConfiguration().then(()=>{// make sure configuration is up to date
returnthis.taskSystemPromise.
then((taskSystem)=>{
returntaskSystem.isActive().then((active)=>{
if(!active){
returnfn(taskSystem);
letexecuteResult=fn(taskSystem);
if(executeResult.kind===TaskExecuteKind.Active){
letactive=executeResult.active;
if(active.same&&active.watching){
this.messageService.show(Severity.Info,nls.localize('TaskSystem.activeSame','The task is already active and in watch mode.'));
}else{
thrownewTaskError(Severity.Warning,nls.localize('TaskSystem.active','There is an active running task right now. Terminate it first before executing another task.'),TaskErrors.RunningTask);
thrownewTaskError(Severity.Info,nls.localize('TaskRunnerSystem.noBuildTask','No task is marked as a build task in the tasks.json. Mark a task with \'isBuildCommand\'.'),TaskErrors.NoBuildTask);
thrownewTaskError(Severity.Error,nls.localize('TaskRunnerSystem.fatalError','The provided task configuration has validation errors. See tasks output log for details.'),TaskErrors.ConfigValidationError);