mirror of
https://github.com/labwc/labwc.git
synced 2026-04-11 08:21:13 -04:00
actions: Prevent env var expansion for subshells like $()
We currently expand Execute action commands like `sh -c 'echo $(date) >> /tmp/foo'` to `sh -c 'echo (date) >> /tmp/foo'` This obviously breaks the subshell. This patch fixes it by preventing single `$` being replaced with nothing.
This commit is contained in:
parent
bd6efe4849
commit
8c343e89c7
1 changed files with 7 additions and 0 deletions
|
|
@ -33,6 +33,13 @@ buf_expand_shell_variables(struct buf *s)
|
|||
++p;
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
/* Don't expand single $ (as used by subshells) */
|
||||
if (!strlen(environment_variable.buf)) {
|
||||
buf_add(&new, "$");
|
||||
continue;
|
||||
}
|
||||
|
||||
i += strlen(environment_variable.buf);
|
||||
strip_curly_braces(environment_variable.buf);
|
||||
p = getenv(environment_variable.buf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue