This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,7 @@ class ProcessTask<T> : TaskBase<T>, IProcessTask<T>
213
213
{
214
214
private IOutputProcessor < T > outputProcessor ;
215
215
private ProcessWrapper wrapper ;
216
+ private bool finished = false ;
216
217
217
218
public event Action < string > OnErrorData ;
218
219
public event Action < IProcess > OnStartProcess ;
@@ -302,6 +303,7 @@ public override T RunWithReturn(bool success)
302
303
RaiseOnStart ,
303
304
( ) =>
304
305
{
306
+ finished = true ;
305
307
try
306
308
{
307
309
if ( outputProcessor != null )
@@ -350,7 +352,7 @@ public override string ToString()
350
352
351
353
public Process Process { get ; set ; }
352
354
public int ProcessId { get { return Process . Id ; } }
353
- public override bool Successful { get { return ! taskFailed && Task . Status == TaskStatus . RanToCompletion && Process . ExitCode == 0 ; } }
355
+ public override bool Successful { get { return finished && ( ( ! taskFailed && Process . ExitCode == 0 ) || ( taskFailed && exceptionWasHandled ) ) ; } }
354
356
public StreamWriter StandardInput { get { return wrapper ? . Input ; } }
355
357
public virtual string ProcessName { get ; protected set ; }
356
358
public virtual string ProcessArguments { get ; }
Original file line number Diff line number Diff line change @@ -491,7 +491,7 @@ public override string ToString()
491
491
return $ "{ Task ? . Id ?? - 1 } { Name } { GetType ( ) } ";
492
492
}
493
493
494
- public virtual bool Successful { get { return ! taskFailed || exceptionWasHandled ; /*Task.Status == TaskStatus.RanToCompletion && Task.Status != TaskStatus.Faulted;*/ } }
494
+ public virtual bool Successful { get { return ! taskFailed || exceptionWasHandled ; } }
495
495
public string Errors { get ; protected set ; }
496
496
public Task Task { get ; protected set ; }
497
497
public bool IsCompleted { get { return hasRun ; /*(Task as IAsyncResult).IsCompleted;*/ } }
You can’t perform that action at this time.
0 commit comments