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();
|
ensureReaperStarted();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Files.writeString(inputDir.resolve(serviceId + ".cmd"), String.join(" ", command));
|
Files.writeString(getCmdFile(serviceId), String.join(" ", command));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UncheckedIOException(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) {
|
public void unregister(String serviceId) {
|
||||||
try {
|
try {
|
||||||
Files.deleteIfExists(inputDir.resolve(serviceId + ".cmd"));
|
Files.deleteIfExists(getCmdFile(serviceId));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UncheckedIOException(e);
|
throw new UncheckedIOException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue