Add more details to the functioning of _cmd_quote

This commit is contained in:
twangboy 2018-08-27 15:13:04 -06:00
parent a9856e2d4c
commit b0d646d69c
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

View file

@ -153,7 +153,8 @@ def _status_wait(service_name, end_time, service_states):
def _cmd_quote(cmd):
'''
Helper function to properly format the path to the binary for the service
Must be double quoted. No single quotes. For example:
Must be wrapped in double quotes to account for paths that have spaces. For
example:
``"C:\Program Files\Path\to\bin.exe"``
@ -163,7 +164,7 @@ def _cmd_quote(cmd):
Returns:
str: Properly quoted path to the binary
'''
# Remove all single and double quotes
# Remove all single and double quotes from the beginning and the end
pattern = re.compile('^(\\"|\').*|.*(\\"|\')$')
while pattern.match(cmd) is not None:
cmd = cmd.strip('"').strip('\'')