summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-05-16 15:27:06 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-05-16 16:15:31 (GMT)
commit81d45dabc4534f15b8c61935060cd4d10f258f15 (patch)
treee4656dc9464d264b4450720c8e90f275df6fb834
parentbafb6e999d41a2b613e3c92ade97025de9d2ca27 (diff)
downloadCMake-81d45dabc4534f15b8c61935060cd4d10f258f15.zip
CMake-81d45dabc4534f15b8c61935060cd4d10f258f15.tar.gz
CMake-81d45dabc4534f15b8c61935060cd4d10f258f15.tar.bz2
cmOutputConverter: add a `static` version of `EscapeForShell`
-rw-r--r--Source/cmOutputConverter.cxx15
-rw-r--r--Source/cmOutputConverter.h1
2 files changed, 11 insertions, 5 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 53cb21e..02981ae 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -243,11 +243,6 @@ std::string cmOutputConverter::EscapeForShell(cm::string_view str,
bool unescapeNinjaConfiguration,
bool forResponse) const
{
- // Do not escape shell operators.
- if (cmOutputConverterIsShellOperator(str)) {
- return std::string(str);
- }
-
// Compute the flags for the target shell environment.
int flags = 0;
if (this->GetState()->UseWindowsVSIDE()) {
@@ -283,6 +278,16 @@ std::string cmOutputConverter::EscapeForShell(cm::string_view str,
flags |= Shell_Flag_IsUnix;
}
+ return cmOutputConverter::EscapeForShell(str, flags);
+}
+
+std::string cmOutputConverter::EscapeForShell(cm::string_view str, int flags)
+{
+ // Do not escape shell operators.
+ if (cmOutputConverterIsShellOperator(str)) {
+ return std::string(str);
+ }
+
return Shell_GetArgument(str, flags);
}
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 625d897..0ee7afb 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -107,6 +107,7 @@ public:
bool forEcho = false, bool useWatcomQuote = false,
bool unescapeNinjaConfiguration = false,
bool forResponse = false) const;
+ static std::string EscapeForShell(cm::string_view str, int flags);
enum class WrapQuotes
{