Use double-quoting of commands in Windows.

This commit is contained in:
Alexander Shaduri committed 2024-05-17 16:56:44 +04:00
1 parent debe2e63cb
commit 501134c2fd
7 files changed
+30 -10

No files matched your search

+14
View File
@@ -13,6 +13,8 @@ Copyright:
#include <glib.h> // g_usleep()
#include "command_executor.h"
#include "build_config.h"
#include "hz/string_algo.h"
@@ -251,6 +253,18 @@ std::string CommandExecutor::get_error_header()
std::string CommandExecutor::shell_quote(const std::string& str)
{
if (!BuildEnv::is_kernel_family_windows()) {
return Glib::shell_quote(str);
}
// This may be somewhat insecure, but g_spawn_command_line_async()
// does not work with single quotes on Windows.
return "\"" + hz::string_replace_copy(str, "\"", "\\\"") + "\"";
}
sigc::signal<bool, CommandExecutor::TickStatus>& CommandExecutor::signal_execute_tick()
{
return signal_execute_tick_;