If you create a server using CreateBuildWithManagedContainer and specify
StartMultiplayerServerCommand to include a command line argument that contains dots (.), a space is inserted before the dot splitting the single command line argument into two arguments.
Steps to Reproduce
- Create a build of a Windows custom game server
- Invoke the CreateBuildWithManagedContainer API and set StartMultiplayerServerCommand to be something like the following:
C:\Assets\Server.exe -Argument=Alpha.Beta
3. Log in to a PlayFab VM for the newly created build and run powershell as administrator
4. Run the following command inside this powershell prompt:
Get-WmiObject Win32_Process -Filter "name = 'Server.exe'" | Select-Object CommandLine
Expected Result
C:\Assets\Server.exe -Argument=Alpha.Beta
Actual Result
C:\Assets\Server.exe -Argument=Alpha .Beta
Workaround
Place the command argument in single quotes when specifying StartMultiplayerServerCommand:
C:\Assets\Server.exe '-Argument=Alpha.Beta'
Discussion
The PlayFab agent appears to run the following command for a managed container in docker:
powershell.exe ..\scripts\WindowsContainerStartupScript.ps1; "cmd /c C:\Assets\Server.exe -Argument=Alpha.Beta"
Powershell then mangles this when running cmd.exe:
"C:\Windows\system32\cmd.exe" /c C:\Assets\Server.exe -Argument=Alpha .Beta
cmd.exe then mangles this to the following command line:
C:\Assets\Server.exe -Argument=Alpha .Beta
I was unable to find any documentation indicating that powershell then cmd.exe were used to run the custom game server executable and therefore didn't expect my command line arguments to be mangled. Would it be possible to escape the command line or at least document this unexpected behaviour?