From ca3c091db5195020bae75562aeadd3f12ccbbd87 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 14 Dec 2024 19:24:00 +0800 Subject: [PATCH] . --- main/client/src/mill/main/client/ServerLauncher.java | 5 ----- .../client/src/mill/runner/client/MillClientMain.java | 2 +- .../src/mill/runner/client/MillProcessLauncher.java | 10 ++++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/main/client/src/mill/main/client/ServerLauncher.java b/main/client/src/mill/main/client/ServerLauncher.java index f619ba7b9f3..5590cc3e712 100644 --- a/main/client/src/mill/main/client/ServerLauncher.java +++ b/main/client/src/mill/main/client/ServerLauncher.java @@ -116,11 +116,6 @@ public Result acquireLocksAndRun(String outDir) throws Exception { } int run(Path serverDir, boolean setJnaNoSys, Locks locks) throws Exception { - // Clear out run-related files from the server folder to make sure we - // never hit issues where we are reading the files from a previous run - Files.deleteIfExists(serverDir.resolve(ServerFiles.exitCode)); - Files.deleteIfExists(serverDir.resolve(ServerFiles.terminfo)); - Files.deleteIfExists(serverDir.resolve(ServerFiles.runArgs)); try (OutputStream f = Files.newOutputStream(serverDir.resolve(ServerFiles.runArgs))) { f.write(System.console() != null ? 1 : 0); diff --git a/runner/client/src/mill/runner/client/MillClientMain.java b/runner/client/src/mill/runner/client/MillClientMain.java index 24452c2ac16..ab8a1db6868 100644 --- a/runner/client/src/mill/runner/client/MillClientMain.java +++ b/runner/client/src/mill/runner/client/MillClientMain.java @@ -54,7 +54,7 @@ public void initServer(Path serverDir, boolean setJnaNoSys, Locks locks) } public void preRun(Path serverDir) throws Exception { - MillProcessLauncher.runTermInfoThread(serverDir); + MillProcessLauncher.prepareMillRunFolder(serverDir); } }; int exitCode = launcher.acquireLocksAndRun(OutFiles.out).exitCode; diff --git a/runner/client/src/mill/runner/client/MillProcessLauncher.java b/runner/client/src/mill/runner/client/MillProcessLauncher.java index 3aed5922159..0b862e0ee49 100644 --- a/runner/client/src/mill/runner/client/MillProcessLauncher.java +++ b/runner/client/src/mill/runner/client/MillProcessLauncher.java @@ -33,7 +33,7 @@ static int launchMillNoServer(String[] args) throws Exception { boolean interrupted = false; try { - MillProcessLauncher.runTermInfoThread(processDir); + MillProcessLauncher.prepareMillRunFolder(processDir); Process p = configureRunMillProcess(builder, processDir); return p.waitFor(); @@ -255,7 +255,13 @@ public static boolean checkTputExists() { } } - public static void runTermInfoThread(Path serverDir) throws Exception { + public static void prepareMillRunFolder(Path serverDir) throws Exception { + // Clear out run-related files from the server folder to make sure we + // never hit issues where we are reading the files from a previous run + Files.deleteIfExists(serverDir.resolve(ServerFiles.exitCode)); + Files.deleteIfExists(serverDir.resolve(ServerFiles.terminfo)); + Files.deleteIfExists(serverDir.resolve(ServerFiles.runArgs)); + Path sandbox = serverDir.resolve(ServerFiles.sandbox); Files.createDirectories(sandbox); boolean tputExists = checkTputExists();