fix<Command>: fix crash when cancel a process that already

This commit is contained in:
leo 2021-07-13 15:35:18 +08:00
parent 17e9ce2a2f
commit e7a7c0518e

View file

@ -79,9 +79,9 @@ namespace SourceGit.Commands {
proc.CancelErrorRead();
proc.CancelOutputRead();
#if NET48
proc.Kill();
if (!proc.HasExited) proc.Kill();
#else
proc.Kill(true);
if (!proc.HasExited) proc.Kill(true);
#endif
return;
}
@ -95,17 +95,16 @@ namespace SourceGit.Commands {
proc.CancelErrorRead();
proc.CancelOutputRead();
#if NET48
proc.Kill();
if (!proc.HasExited) proc.Kill();
#else
proc.Kill(true);
if (!proc.HasExited) proc.Kill(true);
#endif
return;
}
if (e.Data == null) return;
if (TraitErrorAsOutput) OnReadline(e.Data);
if (string.IsNullOrEmpty(e.Data)) return;
if (TraitErrorAsOutput) OnReadline(e.Data);
if (progressFilter.IsMatch(e.Data)) return;
if (e.Data.StartsWith("remote: Counting objects:", StringComparison.Ordinal)) return;
errs.Add(e.Data);