fix(capture): start and stop the replay sandbox on Windows too

The sandbox launched its servers with fork, setpgid and waitpid only. Starting,
waiting and stopping now go through one small platform section: POSIX keeps
the process group, Windows uses CreateProcess in a job object that is ended as
one (and dies with the tool). Environment overrides are cleared in the tool
itself, program names get .exe on Windows, and shared folders fall back to a
copy where links can't be made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 22:11:40 -05:00
parent 8680195da6
commit 9043f97622
2 changed files with 163 additions and 32 deletions

View File

@@ -4,7 +4,6 @@
#include <filesystem>
#include <memory>
#include <string>
#include <sys/types.h>
#include "json.hpp"
@@ -16,6 +15,9 @@
* read-only; CDServer.sqlite is copied. The folder is deleted afterwards unless it is kept.
*/
namespace Sandbox {
// A started process: its pid, or its process handle on Windows (0: none)
using ProcessHandle = intptr_t;
struct Options {
std::filesystem::path serverDir; // built servers (MasterServer, AuthServer, ChatServer, WorldServer, migrations, ...)
std::filesystem::path root; // sandboxes are made in here
@@ -47,7 +49,7 @@ namespace Sandbox {
private:
Options m_Options;
std::filesystem::path m_Dir;
pid_t m_Master{};
ProcessHandle m_Master{};
bool m_Keep{};
};