diff --git a/src/Tests/ToolLauncherTests.cs b/src/Tests/ToolLauncherTests.cs index 7320f23..999e18e 100644 --- a/src/Tests/ToolLauncherTests.cs +++ b/src/Tests/ToolLauncherTests.cs @@ -56,5 +56,6 @@ public void ToStartInfo_preserves_no_shell_and_no_redirect() Assert.False(start.RedirectStandardOutput); Assert.False(start.RedirectStandardError); Assert.Equal(["--flag"], start.ArgumentList.ToArray()); + Assert.Equal("1", start.Environment["NDX_LAUNCHED"]); } } diff --git a/src/ndx/ProcessStartSettings.cs b/src/ndx/ProcessStartSettings.cs index edbaf53..9a27a7c 100644 --- a/src/ndx/ProcessStartSettings.cs +++ b/src/ndx/ProcessStartSettings.cs @@ -4,7 +4,8 @@ namespace ndx; /// /// Process start settings for the downloaded tool. ndx always starts the child -/// without a shell and with inherited standard in/out/error. +/// without a shell, with inherited standard in/out/error, and with +/// NDX_LAUNCHED=1 so the child can tell it was started by ndx. /// public sealed record ProcessStartSettings { @@ -33,6 +34,8 @@ public ProcessStartInfo ToStartInfo() foreach (var argument in Arguments) start.ArgumentList.Add(argument); + start.Environment["NDX_LAUNCHED"] = "1"; + return start; } }