mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
cls_cmd: execute commands through bash
The next commit will use "echo -e". The problem with that is that bash and sh differ: - in bash: this results in "a\nb" (a+newline+b) - in sh: this results in -e a\nb (-e a+newline+b) The problem is that by default, commands are executed through sh, which nobody expects. Change to bash, which is likely more aligned with what people want to use.
This commit is contained in:
@@ -106,10 +106,10 @@ class LocalCmd(Cmd):
|
||||
if line.strip().endswith('&'):
|
||||
# if we wait for stdout, subprocess does not return before the end of the command
|
||||
# however, we don't want to wait for commands with &, so just return fake command
|
||||
ret = sp.run(line, shell=True, cwd=self.cwd, timeout=5)
|
||||
ret = sp.run(line, shell=True, cwd=self.cwd, timeout=5, executable='/bin/bash')
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
ret = sp.run(line, shell=True, cwd=self.cwd, stdout=sp.PIPE, stderr=sp.STDOUT, timeout=timeout)
|
||||
ret = sp.run(line, shell=True, cwd=self.cwd, stdout=sp.PIPE, stderr=sp.STDOUT, timeout=timeout, executable='/bin/bash')
|
||||
except Exception as e:
|
||||
ret = sp.CompletedProcess(args=line, returncode=255, stdout=f'Exception: {str(e)}'.encode('utf-8'))
|
||||
if ret.stdout is None:
|
||||
|
||||
Reference in New Issue
Block a user