mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-11-24 14:56:40 +00:00
Use double-quoting of commands in Windows.
This commit is contained in:
1 parent
debe2e63cb
commit
501134c2fd
7 files changed
+30
-10
No files matched your search
@@ -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_;
|
||||
|
||||
Reference in new issue
Block a user