Fix reaper build failures on Windows (#45205)
We configure the service ID as the node's toString but this containes characters that Windows doesn't like. This PR fixes it by allowing only alphanumeric characters
This commit is contained in:
parent
a453cd489e
commit
b3076adae6
|
@ -63,15 +63,21 @@ public class ReaperService {
|
|||
ensureReaperStarted();
|
||||
|
||||
try {
|
||||
Files.writeString(inputDir.resolve(serviceId + ".cmd"), String.join(" ", command));
|
||||
Files.writeString(getCmdFile(serviceId), String.join(" ", command));
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Path getCmdFile(String serviceId) {
|
||||
return inputDir.resolve(
|
||||
serviceId.replaceAll("[^a-zA-Z0-9]","-") + ".cmd"
|
||||
);
|
||||
}
|
||||
|
||||
public void unregister(String serviceId) {
|
||||
try {
|
||||
Files.deleteIfExists(inputDir.resolve(serviceId + ".cmd"));
|
||||
Files.deleteIfExists(getCmdFile(serviceId));
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue