Skip to content

Commit

Permalink
Drop jprocesses in favor of java.lang.ProcessHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Apr 14, 2021
1 parent 349bdb9 commit 0cb340c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
6 changes: 0 additions & 6 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
<maven-artifact-transfer.version>0.10.0</maven-artifact-transfer.version>
<maven-invoker.version>3.0.1</maven-invoker.version>
<awaitility.version>4.0.3</awaitility.version>
<jprocesses.version>1.6.5</jprocesses.version>
<jboss-logmanager.version>1.0.9</jboss-logmanager.version>
<jgit.version>5.11.0.202103091610-r</jgit.version>
<flyway.version>7.7.3</flyway.version>
Expand Down Expand Up @@ -4833,11 +4832,6 @@
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>${flapdoodle.mongo.version}</version>
</dependency>
<dependency>
<groupId>org.jprocesses</groupId>
<artifactId>jProcesses</artifactId>
<version>${jprocesses.version}</version>
</dependency>

<dependency>
<groupId>org.flywaydb</groupId>
Expand Down
4 changes: 0 additions & 4 deletions test-framework/devmode-test-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
</dependency>
<dependency>
<groupId>org.jprocesses</groupId>
<artifactId>jProcesses</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.jutils.jprocesses.JProcesses;
import org.jutils.jprocesses.model.ProcessInfo;

public class DevModeTestUtils {

public static void killProcesses(String... cmdParts) {
for (ProcessInfo pi : JProcesses.getProcessList()) {
for (String part : cmdParts) {
if (pi.getCommand().contains(part)) {
JProcesses.killProcess(Integer.parseInt(pi.getPid()));
break;
}
}
}
ProcessHandle.allProcesses()
.filter(processHandle -> {
String cmdLine = processHandle.info().commandLine().orElse(null);
if (cmdLine == null) {
return false;
}
for (String part : cmdParts) {
if (cmdLine.contains(part)) {
return true;
}
}
return false;
})
.forEach(ProcessHandle::destroyForcibly);
}

public static void filter(File input, Map<String, String> variables) throws IOException {
Expand Down

0 comments on commit 0cb340c

Please sign in to comment.