It just occured to me that cmd.exe is windows-only

This commit is contained in:
2023-04-15 19:12:02 +02:00
parent 394b848412
commit b7f3c09890

View File

@@ -35,6 +35,14 @@ public static class PasswordGenerator
{ {
ProcessBuilder pb = new ProcessBuilder(); ProcessBuilder pb = new ProcessBuilder();
pb.ProcessFailed += (e) => ExceptionOccured?.Invoke(e); pb.ProcessFailed += (e) => ExceptionOccured?.Invoke(e);
return pb.GetOutput("cmd.exe", $"echo {RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}");
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return pb.GetOutput("cmd.exe", $"echo {RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}");
}
else
{
return pb.GetOutput("echo", $"{RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}");
}
} }
} }