Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 6, 2025

Summary

This PR implements support for launcher_log.txt to capture stdout and stderr from Minecraft processes, matching the behavior of the vanilla Minecraft launcher.

Changes

Modified xmcl-runtime/launch/LaunchService.ts to:

  • Create a launcher_log.txt file in the game directory when launching Minecraft
  • Stream both stdout and stderr output to the file in real-time
  • Properly close the file stream when the game exits or encounters an error
  • Handle stream errors gracefully to prevent crashes

Implementation Details

When a Minecraft process is launched, the launcher now:

  1. Creates the log file: A launcher_log.txt file is created in the game directory (instance path) using a write stream
  2. Captures all output: Both stdout and stderr are written to the file as they are received from the Minecraft process
  3. Handles errors: Stream errors (e.g., permission issues, disk space) are caught and logged without crashing the application
  4. Cleans up properly: The file stream is closed when the game exits normally or when an error occurs

Behavior

.minecraft/
├── launcher_log.txt  ← New file created on each launch
├── logs/
├── saves/
└── ...

Each new launch overwrites the previous launcher_log.txt file, matching vanilla Minecraft launcher behavior. This makes it easier for users and developers to debug launch issues.

Fixes the issue described in #[issue_number] where the launcher was missing this standard Minecraft logging feature.

Original prompt

This section details on the original issue you should resolve

<issue_title>Support laucnher_log.txt for stdout</issue_title>
<issue_description>The vanilla Minecraft launcher will emit a laucnher_log.txt for launch. We need to implement the same thing. And we should consider the stderr log to.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1112

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Support laucnher_log.txt for stdout Add launcher_log.txt support for stdout/stderr logging Oct 6, 2025
@Copilot Copilot AI requested a review from ci010 October 6, 2025 04:29
Copilot finished work on behalf of ci010 October 6, 2025 04:29
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.

Support laucnher_log.txt for stdout
2 participants