mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added docstring for split_command_to_list and modified
This commit is contained in:
parent
9720dac97b
commit
7f47367fbf
1 changed files with 19 additions and 2 deletions
|
|
@ -140,8 +140,25 @@ def run_subprocess(*args, **kwargs):
|
|||
|
||||
|
||||
def split_command_to_list(string_command):
|
||||
"""Split string subprocess command to list."""
|
||||
posix = True
|
||||
"""Split string subprocess command to list.
|
||||
|
||||
Should be able to split complex subprocess command to separated arguments:
|
||||
`"C:\\ffmpeg folder\\ffmpeg.exe" -i \"D:\\input.mp4\\" \"D:\\output.mp4\"`
|
||||
|
||||
Should result into list:
|
||||
`["C:\ffmpeg folder\ffmpeg.exe", "-i", "D:\input.mp4", "D:\output.mp4"]`
|
||||
|
||||
This may be required on few versions of python where subprocess can handle
|
||||
only list of arguments.
|
||||
|
||||
To be able do that is using `shlex` python module.
|
||||
|
||||
Args:
|
||||
string_command(str): Full subprocess command.
|
||||
|
||||
Returns:
|
||||
list: Command separated into individual arguments.
|
||||
"""
|
||||
if platform.system().lower() == "windows":
|
||||
posix = False
|
||||
return shlex.split(string_command, posix=posix)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue