Sanitize arguments to system calls

This commit is contained in:
erik 2023-04-18 12:39:02 +02:00
parent fc17d6a14d
commit eab4a8e3e3

View file

@ -175,8 +175,13 @@ class SystemApi():
self.stdout = [""]
self.stderr = [""]
def run(self, args):
stream = sub.Popen(args,
def run(self, args: list[str]):
sanitized_args = []
for arg in args:
str_arg = str(arg)
if str_arg is not "":
sanitized_args.append(str_arg.replace("\n", ""))
stream = sub.Popen(sanitized_args,
stdout=sub.PIPE,
stderr=sub.PIPE,
text=True,