From 8bcad7198387a5bd884ea28e327da6934353caa5 Mon Sep 17 00:00:00 2001 From: Hollow Man Date: Fri, 25 Oct 2024 00:04:07 +0300 Subject: [PATCH] Escape the __args.remaining before joining together The current way ignores the case and won't work if the arguments include a space. Signed-off-by: Hollow Man --- src/omniperf_profile/profiler_base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/omniperf_profile/profiler_base.py b/src/omniperf_profile/profiler_base.py index 9da4a7c48..25ee241a9 100644 --- a/src/omniperf_profile/profiler_base.py +++ b/src/omniperf_profile/profiler_base.py @@ -26,6 +26,7 @@ from tqdm import tqdm import glob import logging +import shlex import sys import os import re @@ -263,7 +264,7 @@ def pre_processing(self): "Your command %s doesn't point to a executable. Please verify." % self.__args.remaining[0] ) - self.__args.remaining = " ".join(self.__args.remaining) + self.__args.remaining = " ".join(shlex.quote(arg) for arg in self.__args.remaining) else: console_error( "Profiling command required. Pass application executable after -- at the end of options.\n\t\ti.e. omniperf profile -n vcopy -- ./vcopy -n 1048576 -b 256"