@@ -33,7 +33,7 @@ import { IOutputService } from 'vs/workbench/contrib/output/common/output';
3333import { StartStopProblemCollector , WatchingProblemCollector , ProblemCollectorEventKind , ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors' ;
3434import {
3535 Task , CustomTask , ContributedTask , RevealKind , CommandOptions , ShellConfiguration , RuntimeType , PanelKind ,
36- TaskEvent , TaskEventKind , ShellQuotingOptions , ShellQuoting , CommandString , CommandConfiguration , ExtensionTaskSource , TaskScope , RevealProblemKind , DependsOrder
36+ TaskEvent , TaskEventKind , ShellQuotingOptions , ShellQuoting , CommandString , CommandConfiguration , ExtensionTaskSource , TaskScope , RevealProblemKind , DependsOrder , InMemoryTask
3737} from 'vs/workbench/contrib/tasks/common/tasks' ;
3838import {
3939 ITaskSystem , ITaskSummary , ITaskExecuteResult , TaskExecuteKind , TaskError , TaskErrors , ITaskResolver ,
@@ -250,10 +250,12 @@ export class TerminalTaskSystem implements ITaskSystem {
250250 executeResult . promise . then ( summary => {
251251 this . lastTask = this . currentTask ;
252252 } ) ;
253- if ( ! this . instances [ commonKey ] ) {
254- this . instances [ commonKey ] = new InstanceManager ( ) ;
253+ if ( InMemoryTask . is ( task ) || ! this . isTaskEmpty ( task ) ) {
254+ if ( ! this . instances [ commonKey ] ) {
255+ this . instances [ commonKey ] = new InstanceManager ( ) ;
256+ }
257+ this . instances [ commonKey ] . addInstance ( ) ;
255258 }
256- this . instances [ commonKey ] . addInstance ( ) ;
257259 return executeResult ;
258260 } catch ( error ) {
259261 if ( error instanceof TaskError ) {
@@ -606,8 +608,7 @@ export class TerminalTaskSystem implements ITaskSystem {
606608 const resolvedVariables = this . resolveVariablesFromSet ( systemInfo , workspaceFolder , task , variables , alreadyResolved ) ;
607609
608610 return resolvedVariables . then ( ( resolvedVariables ) => {
609- const isCustomExecution = ( task . command . runtime === RuntimeType . CustomExecution ) ;
610- if ( resolvedVariables && ( task . command !== undefined ) && task . command . runtime && ( isCustomExecution || ( task . command . name !== undefined ) ) ) {
611+ if ( resolvedVariables && ! this . isTaskEmpty ( task ) ) {
611612 this . currentTask . resolvedVariables = resolvedVariables ;
612613 return this . executeInTerminal ( task , trigger , new VariableResolver ( workspaceFolder , systemInfo , resolvedVariables . variables , this . configurationResolverService ) , workspaceFolder ) ;
613614 } else {
@@ -620,6 +621,11 @@ export class TerminalTaskSystem implements ITaskSystem {
620621 } ) ;
621622 }
622623
624+ private isTaskEmpty ( task : CustomTask | ContributedTask ) : boolean {
625+ const isCustomExecution = ( task . command . runtime === RuntimeType . CustomExecution ) ;
626+ return ! ( ( task . command !== undefined ) && task . command . runtime && ( isCustomExecution || ( task . command . name !== undefined ) ) ) ;
627+ }
628+
623629 private reexecuteCommand ( task : CustomTask | ContributedTask , trigger : string , alreadyResolved : Map < string , string > ) : Promise < ITaskSummary > {
624630 const lastTask = this . lastTask ;
625631 if ( ! lastTask ) {
0 commit comments