summaryrefslogtreecommitdiffstats
path: root/source-builder
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-09-06 10:42:28 +1000
committerChris Johns <chrisj@rtems.org>2019-09-06 11:49:28 +1000
commitd8b2719ae6f71c3380fc32aa34ac0796b98af236 (patch)
tree018d8105dbaf448c82e4198a12445507e6d20595 /source-builder
parentfreebsd: SVN is optional. (diff)
downloadrtems-source-builder-d8b2719ae6f71c3380fc32aa34ac0796b98af236.tar.bz2
sb/config: Escape double quotes on Windows for shell macros
Closes #3792
Diffstat (limited to 'source-builder')
-rw-r--r--source-builder/sb/config.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index 8541cb5..58316db 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -421,14 +421,17 @@ class file:
def _shell(self, line):
#
- # Parse the line and handle nesting '()' pairs.
+ # Parse the line and handle nesting '()' pairs. If on Windows
+ # handle embedded '"' (double quotes) as the command is run as
+ # a double quoted string.
#
def _exec(shell_macro):
output = ''
if len(shell_macro) > 3:
e = execute.capture_execution()
if options.host_windows:
- cmd = '%s -c "%s"' % (self.macros.expand('%{__sh}'), shell_macro[2:-1])
+ shell_cmd = ''.join([c if c != '"' else '\\' + c for c in shell_macro[2:-1]])
+ cmd = '%s -c "%s"' % (self.macros.expand('%{__sh}'), shell_cmd)
else:
cmd = shell_macro[2:-1]
exit_code, proc, output = e.shell(cmd)