Do not display exceptions stack trace when trying to stop already stopped daemons, fixes #15

This commit is contained in:
Guillaume Nodet
2019-10-03 14:05:34 +02:00
parent fc1d848d2a
commit d4db34b7e0

View File

@@ -15,6 +15,7 @@
*/
package org.jboss.fuse.mvnd.daemon;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -92,8 +93,15 @@ public class Client {
if (dis.length > 0) {
System.out.println("Stopping " + dis.length + " running daemons");
for (DaemonInfo di : dis) {
new ProcessImpl(di.getPid()).destroy();
registry.remove(di.getUid());
try {
new ProcessImpl(di.getPid()).destroy();
} catch (IOException t) {
System.out.println("Daemon " + di.getUid() + ": " + t.getMessage());
} catch (Exception t) {
System.out.println("Daemon " + di.getUid() + ": " + t);
} finally {
registry.remove(di.getUid());
}
}
}
return;