Skip to content

Conversation

@gdelazzari
Copy link

Besides being recommended by the Python documentation of os.system() itself (https://docs.python.org/3/library/os.html#os.system), the previous implementation with os.system() has the issue of not handling paths with spaces, since the arguments like program_path and object_path were concatenated as strings and then incorrectly parsed by GCC in the presence of whitespace.

With subprocess.run(), we provide a list of arguments and the paths are handled correctly. A small commented piece of code has been introduced to build up an arguments list correctly.

Giacomo De Lazzari added 3 commits May 8, 2023 15:58
Besides being recommended by the Python documentation of `os.system()`
itself (https://docs.python.org/3/library/os.html#os.system), the
previous implementation with `os.system()` has the issue of not handling
paths with spaces, since the arguments like `program_path` and
`object_path` were concatenated as strings and then incorrectly parsed
by GCC in the presence of whitespace.

With `subprocess.run()`, we provide a list of arguments and the paths
are handled correctly. A small commented piece of code has been
introduced to build up an arguments list correctly.
This is relative to the previous commit, and fixes the code in some
instances where the `args` list ended up with empty arguments or
arguments with trailing spaces.
@gdelazzari gdelazzari force-pushed the feature-subprocess.run branch from 41ed506 to 94f4002 Compare May 9, 2023 13:41
Copy link
Collaborator

@jaimesouza jaimesouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @gdelazzari

@jaimesouza jaimesouza merged commit c8e62be into HPCSys-Lab:master May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants