Skip to content

Fix StartGameCommand getting "cmd /c" prefix on Linux containers when host is Windows#207

Merged
dgkanatsios merged 3 commits intomainfrom
copilot/fix-mpsagent-startgamecommand-issues
Mar 30, 2026
Merged

Fix StartGameCommand getting "cmd /c" prefix on Linux containers when host is Windows#207
dgkanatsios merged 3 commits intomainfrom
copilot/fix-mpsagent-startgamecommand-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

GetStartGameCmd and GetGameWorkingDir in DockerContainerEngine check _systemOperations.IsOSPlatform(OSPlatform.Windows) to decide whether to prepend cmd /c and derive a Windows working directory. This checks the host OS, not the container OS—so Linux containers on Windows (via -lcow) get cmd /c sleep 100 which fails immediately.

Changes

  • DockerContainerEngine.cs: Pass isLinuxContainersOnWindows (already available from sessionHostManager.LinuxContainersOnWindows) into GetStartGameCmd and GetGameWorkingDir. Gate Windows-specific logic on IsOSPlatform(Windows) && !isLinuxContainersOnWindows.
// Before
if (_systemOperations.IsOSPlatform(OSPlatform.Windows))

// After
if (_systemOperations.IsOSPlatform(OSPlatform.Windows) && !isLinuxContainersOnWindows)
  • VmAgent.Core.csproj: Add InternalsVisibleTo for test project.
  • DockerContainerEngineTests.cs: 8 new tests covering lcow, native Windows, native Linux, and null/empty command cases.

Copilot AI and others added 2 commits March 30, 2026 16:35
…ers on Windows

When running Linux containers on Windows (with -lcow flag), GetStartGameCmd and
GetGameWorkingDir in DockerContainerEngine incorrectly checked the host OS instead
of the container OS. This caused "cmd /c" to be prepended to Linux commands and
Windows-specific working directory logic to be applied to Linux containers.

The fix passes the isLinuxContainersOnWindows flag (already available via
sessionHostManager.LinuxContainersOnWindows) to both methods, and gates the
Windows-specific logic on the container not being a Linux container on Windows.

Agent-Logs-Url: https://github.com/PlayFab/MpsAgent/sessions/12c2a2a6-39e7-488c-bc18-99f522c21860

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MpsAgent prefix issue with StartGameCommand on Linux Fix StartGameCommand getting "cmd /c" prefix on Linux containers when host is Windows Mar 30, 2026
Copilot AI requested a review from dgkanatsios March 30, 2026 16:40
@dgkanatsios dgkanatsios marked this pull request as ready for review March 30, 2026 20:17
@dgkanatsios dgkanatsios requested a review from a team March 30, 2026 20:17
@dgkanatsios dgkanatsios merged commit 39d5824 into main Mar 30, 2026
9 checks passed
@dgkanatsios dgkanatsios deleted the copilot/fix-mpsagent-startgamecommand-issues branch March 30, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MpsAgent fails when StartGameCommand is not empty

3 participants