File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -282,6 +282,24 @@ export class ExecutorManager implements Disposable {
282282 const name = process . processParameters . processType ! ;
283283 let namedQueue = this . queue . get ( name ) ?? [ ] ;
284284
285+ // When adding the same process as the currently running one, assume that its underlying data was changed,
286+ // and kill the currently active process
287+ if ( this . activeProcess ?. commandLine === process . commandLine ) {
288+ this . killProcess ( ) ;
289+ }
290+
291+ // The exact same task with the exact same commandline won't be added twice
292+ if ( namedQueue . some ( ( queueItem ) => queueItem . commandLine === process . commandLine ) ) {
293+ // In Prepend mode, this means removing and re-adding to move the task to the front of the queue
294+ if ( method === 'prepend' ) {
295+ namedQueue = namedQueue . filter ( ( queueItem ) => queueItem . commandLine !== process . commandLine ) ;
296+ } else {
297+ // Otherwise, keep the process in the queue as is, to preserve its position
298+ this . startNextProcess ( ) ;
299+ return ;
300+ }
301+ }
302+
285303 switch ( method ) {
286304 case 'replace' :
287305 namedQueue = [ process ] ;
You can’t perform that action at this time.
0 commit comments