From b7f3c09890a70a9381a80368dbeb4357f1fed93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miskolczi=20Rich=C3=A1rd?= Date: Sat, 15 Apr 2023 19:12:02 +0200 Subject: [PATCH] It just occured to me that cmd.exe is windows-only --- Common/PasswordGenerator.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Common/PasswordGenerator.cs b/Common/PasswordGenerator.cs index 0603694..f71cee0 100644 --- a/Common/PasswordGenerator.cs +++ b/Common/PasswordGenerator.cs @@ -35,6 +35,14 @@ public static class PasswordGenerator { ProcessBuilder pb = new ProcessBuilder(); 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}"); + } } }