@@ -33,7 +33,7 @@ import { IOutputService } from 'vs/workbench/contrib/output/common/output';
33
33
import { StartStopProblemCollector , WatchingProblemCollector , ProblemCollectorEventKind , ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors' ;
34
34
import {
35
35
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
37
37
} from 'vs/workbench/contrib/tasks/common/tasks' ;
38
38
import {
39
39
ITaskSystem , ITaskSummary , ITaskExecuteResult , TaskExecuteKind , TaskError , TaskErrors , ITaskResolver ,
@@ -250,10 +250,12 @@ export class TerminalTaskSystem implements ITaskSystem {
250
250
executeResult . promise . then ( summary => {
251
251
this . lastTask = this . currentTask ;
252
252
} ) ;
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 ( ) ;
255
258
}
256
- this . instances [ commonKey ] . addInstance ( ) ;
257
259
return executeResult ;
258
260
} catch ( error ) {
259
261
if ( error instanceof TaskError ) {
@@ -606,8 +608,7 @@ export class TerminalTaskSystem implements ITaskSystem {
606
608
const resolvedVariables = this . resolveVariablesFromSet ( systemInfo , workspaceFolder , task , variables , alreadyResolved ) ;
607
609
608
610
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 ) ) {
611
612
this . currentTask . resolvedVariables = resolvedVariables ;
612
613
return this . executeInTerminal ( task , trigger , new VariableResolver ( workspaceFolder , systemInfo , resolvedVariables . variables , this . configurationResolverService ) , workspaceFolder ) ;
613
614
} else {
@@ -620,6 +621,11 @@ export class TerminalTaskSystem implements ITaskSystem {
620
621
} ) ;
621
622
}
622
623
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
+
623
629
private reexecuteCommand ( task : CustomTask | ContributedTask , trigger : string , alreadyResolved : Map < string , string > ) : Promise < ITaskSummary > {
624
630
const lastTask = this . lastTask ;
625
631
if ( ! lastTask ) {
0 commit comments