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