From 4852aae049acee036768391b3c452c8ae8859ba5 Mon Sep 17 00:00:00 2001 From: Grant Hernandez Date: Tue, 16 Jan 2024 16:13:34 -0500 Subject: [PATCH] CLI Launch: Shlex executable path If an executable path has a single quote (') in it, it can now be launched. Fix protontricks-launch tests `shlex.quote` usage means that single quotes are no longer added unnecessarily to the executable path. Co-authored-by: Janne Pulkkinen --- src/protontricks/cli/launch.py | 2 +- tests/cli/test_launch.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protontricks/cli/launch.py b/src/protontricks/cli/launch.py index 4aff775..f5079d4 100644 --- a/src/protontricks/cli/launch.py +++ b/src/protontricks/cli/launch.py @@ -176,7 +176,7 @@ def exit_(error): cli_args += ["--no-term"] inner_args = " ".join( - ["wine", f"'{executable_path}'"] + ["wine", shlex.quote(str(executable_path))] + exec_args ) diff --git a/tests/cli/test_launch.py b/tests/cli/test_launch.py index e4d221e..1bd5c84 100644 --- a/tests/cli/test_launch.py +++ b/tests/cli/test_launch.py @@ -29,7 +29,7 @@ def test_run_executable( # 'test.exe' was executed command = commands[-1] assert command.args.startswith("wine ") - assert command.args.endswith("/test.exe'") + assert command.args.endswith("/test.exe") assert command.env["WINEPREFIX"] == str(steam_app.prefix_path) @@ -45,7 +45,7 @@ def test_run_executable_appid( # 'test.exe' was executed command = commands[-1] assert command.args.startswith("wine ") - assert command.args.endswith("/test.exe'") + assert command.args.endswith("/test.exe") assert command.env["WINEPREFIX"] == str(steam_app.prefix_path) @@ -123,7 +123,7 @@ def _set_launch_args(*args, **kwargs): "--no-background-wineserver", "--no-term", "-c" ] assert cli_args[6].startswith("wine ") - assert cli_args[6].endswith("test.exe'") + assert cli_args[6].endswith("test.exe") assert cli_args[7] == "10" # Steam installation was provided to the main entrypoint