Skip to content

Commit

Permalink
protect run_bat_as_admin against spaces in file_path
Browse files Browse the repository at this point in the history
fixes #107
  • Loading branch information
dennisvang committed Feb 13, 2024
1 parent 89ef64d commit f8ce576
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tufup/utils/platform_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def run_bat_as_admin(file_path: Union[pathlib.Path, str]):
None, # handle to parent window
'runas', # verb
'cmd.exe', # file on which verb acts
' '.join(['/c', str(file_path)]), # parameters
' '.join(['/c', f'"{file_path}"']), # parameters
None, # working directory (default is cwd)
1, # show window normally
)
Expand Down Expand Up @@ -217,6 +217,7 @@ def _install_update_win(
logger.debug(f'starting script in new console: {script_path}')
# start the script in a separate process, non-blocking
if as_admin:
logger.debug('as admin')
run_bat_as_admin(file_path=script_path)
else:
# by default we create a new console with window, but user can override this
Expand Down

0 comments on commit f8ce576

Please sign in to comment.