Skip to content

Commit 1b12fcc

Browse files
authored
Merge pull request #27 from rivques/master
fix: allow non-default ports to be sent to the server binary on Linux
2 parents d360a0b + b123e57 commit 1b12fcc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

rlbot/utils/gateway.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
from rlbot.interface import RLBOT_SERVER_PORT
1111
from rlbot.utils.logging import DEFAULT_LOGGER
12+
from rlbot.utils.os_detector import CURRENT_OS
1213

14+
if CURRENT_OS != "Windows":
15+
import shlex
1316

1417
def find_main_executable_path(
1518
main_executable_path: Path, main_executable_name: str
@@ -72,7 +75,11 @@ def launch(
7275
)
7376

7477
port = find_open_server_port()
75-
args = [str(path), str(port)]
78+
79+
if CURRENT_OS == "Windows":
80+
args = [str(path), str(port)]
81+
else:
82+
args = f"{shlex.quote(path.as_posix())} {port}" # on Unix, when shell=True, args must be a string for flags to reach the executable
7683
DEFAULT_LOGGER.info("Launching RLBotServer with via %s", args)
7784

7885
return subprocess.Popen(args, shell=True, cwd=directory), port

0 commit comments

Comments
 (0)