-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt to run a command prompt command if on windows and process fails to start #99
Comments
Added this to my code and it seems to work (not sure about the method name, but what-evs): static void RunCmd(string name, string args = null, string workingDirectory = null, bool noEcho = false)
{
try
{
Run(name, args, workingDirectory, noEcho);
}
catch (Win32Exception ex) when (ex.NativeErrorCode == 2) // The system cannot find the file specified.
{
var cmdArgs = $"/C {name}";
if (args != null)
{
cmdArgs += " " + args;
}
Run("cmd", cmdArgs, workingDirectory, noEcho);
}
} |
@damianh what is the root cause of not being able to run |
FTR this was discussed at great length in Slack. |
Yeah we figured some stuff out :) The slack discussion will eventually be purged but the gist of it is that on windows we launch processes via |
Closing in favour of #100 |
We have this code in our build at https://github.com/SQLStreamStore/SQLStreamStore.HAL/blob/f3bfa641154b7c0a82c0d94e1ddec9ffd6c8c774/build/Program.cs#L131-L134
I'd rather just write
But running that results in an exception on windows:
Suggestion: on windows, catch this and then attempt
Run("cmd", $"/c {name} {arg}", workingDirectory);
?The text was updated successfully, but these errors were encountered: