diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-04-29 15:45:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 15:45:25 -0400 |
| commit | ad6f3070251f25cf022c231b8567d78e98061127 (patch) | |
| tree | 1fa9d2058f8e86710a9e716e493473217b6dff77 /source/core/unix | |
| parent | 972bd3c4c24b06501c52127416afb763a066b8ad (diff) | |
Simplify CommandLine by removing Escaping (#1825)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Split out StringEscapeUtil.
* Added StringEscapeUtil.
* Fix typo in unix quoting type.
* Small comment improvements.
* Try to fix linux linking issue.
* Fix typo.
* Attempt to fix linux link issue.
* Update VS proj even though nothing really changed.
* Fix another typo issue.
* Fix for windows issue.
Fixed bug.
* Make separate Utils for escaping.
* Fix typo.
* Split out into StringEscapeHandler.
* Windows shell does handle removing quotes (so remove code to remove them).
* Handle unescaping if not initiating using the shell.
* Slight improvement around shell like decoding.
* Simplify command extraction.
* Add shared-library category type.
* Fix bug in command extraction.
* Typo in transcendental category.
* Enable unit-test on in smoke test category.
* Make parsing failing output as a failing test.
* Fixes for transcendental tests. Disable tests that do not work.
* Changed category parsing.
* Removed the TestResult parameter from _gatherTestsForFile.
Made testsList only output.
* Remove testing if all tests were disabled.
* Make args of CommandLine always unescaped.
* Add category.
* Don't need escaping on unix/linux.
* Remove some no longer used functions.
Diffstat (limited to 'source/core/unix')
| -rw-r--r-- | source/core/unix/slang-unix-process-util.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/source/core/unix/slang-unix-process-util.cpp b/source/core/unix/slang-unix-process-util.cpp index a3b66af38..24107fab3 100644 --- a/source/core/unix/slang-unix-process-util.cpp +++ b/source/core/unix/slang-unix-process-util.cpp @@ -4,6 +4,7 @@ #include "../slang-common.h" #include "../slang-string-util.h" #include "../slang-string-escape-util.h" +#include "../slang-memory-arena.h" #include <stdio.h> #include <stdlib.h> @@ -40,20 +41,15 @@ namespace Slang { auto escapeHandler = getEscapeHandler(); // When outputting the command line we potentially need to escape the path to the - // command and args - that aren't already explicitly marked as escaped. + // command and args - that aren't already explicitly marked as escaped. + StringBuilder cmd; StringEscapeUtil::appendMaybeQuoted(escapeHandler, commandLine.m_executable.getUnownedSlice(), cmd); for (const auto& arg : commandLine.m_args) { cmd << " "; - if (arg.type == CommandLine::ArgType::Unescaped) - { - StringEscapeUtil::appendMaybeQuoted(escapeHandler, arg.value.getUnownedSlice(), cmd); - } - else - { - cmd << arg.value; - } + + StringEscapeUtil::appendMaybeQuoted(escapeHandler, arg.getUnownedSlice(), cmd); } return cmd.ToString(); } @@ -63,16 +59,17 @@ namespace Slang { outExecuteResult.init(); List<char const*> argPtrs; + // Add the command argPtrs.add(commandLine.m_executable.getBuffer()); - // Add all the args - they don't need any explicit escaping + // Add all the args - they don't need any explicit escaping for (auto arg : commandLine.m_args) { - // All args for this target must be unescaped - SLANG_ASSERT(arg.type == CommandLine::ArgType::Unescaped); - argPtrs.add(arg.value.getBuffer()); + // All args for this target must be unescaped (as they are in CommandLine) + argPtrs.add(arg.getBuffer()); } + // Terminate with a null argPtrs.add(nullptr); |
