mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
shell_helpers: force_oneline actually forces oneline cd and env vars
This commit is contained in:
@@ -140,12 +140,14 @@ class ShellHelpers:
|
|||||||
out = []
|
out = []
|
||||||
if extra_env is None:
|
if extra_env is None:
|
||||||
extra_env = {}
|
extra_env = {}
|
||||||
|
preffix_arr = []
|
||||||
if cwd is not None:
|
if cwd is not None:
|
||||||
out.append('cd {} &&'.format(shlex.quote(cwd)))
|
preffix_arr.append('cd {} &&'.format(shlex.quote(cwd)))
|
||||||
|
extra_env2 = extra_env.copy()
|
||||||
if extra_paths is not None:
|
if extra_paths is not None:
|
||||||
out.append('PATH="{}:${{PATH}}"'.format(':'.join(extra_paths)))
|
extra_env2['PATH'] = '{}:"${{PATH}}"'.format(shlex.quote(':'.join(extra_paths)))
|
||||||
for key in extra_env:
|
for key in extra_env2:
|
||||||
out.append('{}={}'.format(shlex.quote(key), shlex.quote(extra_env[key])))
|
preffix_arr.append('{}={}'.format(shlex.quote(key), shlex.quote(extra_env2[key])))
|
||||||
cmd_quote = []
|
cmd_quote = []
|
||||||
newline_count = 0
|
newline_count = 0
|
||||||
for arg in cmd:
|
for arg in cmd:
|
||||||
@@ -164,6 +166,10 @@ class ShellHelpers:
|
|||||||
)
|
)
|
||||||
if not x
|
if not x
|
||||||
]
|
]
|
||||||
|
if self.force_oneline(force_oneline):
|
||||||
|
cmd_quote = [' '.join(preffix_arr + cmd_quote)]
|
||||||
|
else:
|
||||||
|
cmd_quote = preffix_arr + cmd_quote
|
||||||
out.extend(cmd_quote)
|
out.extend(cmd_quote)
|
||||||
if stdin_path is not None:
|
if stdin_path is not None:
|
||||||
out.append('< {}'.format(shlex.quote(stdin_path)))
|
out.append('< {}'.format(shlex.quote(stdin_path)))
|
||||||
|
|||||||
Reference in New Issue
Block a user