escape arguments for bash

This commit is contained in:
TSrgy
2021-04-29 21:11:16 +05:00
parent ac77ccce9f
commit e5d47e077b

View File

@@ -19,7 +19,8 @@ namespace ElectronNET.CLI
else
{
// works for OSX and Linux (at least on Ubuntu)
cmd.StartInfo = new ProcessStartInfo("bash", "-c " + command);
var escapedArgs = command.Replace("\"", "\\\"");
cmd.StartInfo = new ProcessStartInfo("bash", $"-c \"{escapedArgs}\"");
}
cmd.StartInfo.RedirectStandardInput = true;