Skip to content

Commit d0520a1

Browse files
committed
Updates to SnippetRunner for C# to properly kill subtasks
1 parent bcee1f3 commit d0520a1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

csharp/runner/SnippetRunner/InstallLocations.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,16 @@ private static bool IsDirectory(string path)
306306
{
307307
case PlatformID.Win32NT:
308308
defaultSupportPath = Path.Combine(installDir.FullName, "data");
309-
break;
309+
break;
310310
case PlatformID.MacOSX:
311311
defaultSupportPath = Path.Combine(installDir.FullName, "data");
312312
break;
313313
case PlatformID.Unix:
314314
break;
315315
default:
316-
throw new NotSupportedException(
317-
"Unsupported Operating System: "
318-
+ Environment.OSVersion.Platform);
316+
throw new NotSupportedException(
317+
"Unsupported Operating System: "
318+
+ Environment.OSVersion.Platform);
319319
}
320320

321321
// no explicit path, try the default support path

csharp/runner/SnippetRunner/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,9 @@ static void ExecuteSnippet(string snippet,
544544

545545

546546
ProcessStartInfo killStartInfo
547-
= new ProcessStartInfo("kill", "" + process.Id);
547+
= (Environment.OSVersion.Platform == PlatformID.Win32NT)
548+
? new ProcessStartInfo("taskkill", ["/F", "/PID", "" + process.Id])
549+
: new ProcessStartInfo("kill", "" + process.Id);
548550

549551
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
550552
startInfo.UseShellExecute = false;

0 commit comments

Comments
 (0)