Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Dec 14, 2024
1 parent 40e41b4 commit ca3c091
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 0 additions & 5 deletions main/client/src/mill/main/client/ServerLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion runner/client/src/mill/runner/client/MillClientMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions runner/client/src/mill/runner/client/MillProcessLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ca3c091

Please sign in to comment.