Skip to content

Commit

Permalink
Blindly trying to fix the smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbachorik committed Nov 20, 2024
1 parent 17ef73a commit 0fa642e
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions internal-api/src/main/java/datadog/trace/util/PidHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,30 @@ public static Set<String> getJavaPids() {
// start draining the subcommand's pipes asynchronously to avoid flooding them
CompletableFuture<Set<String>> collecting =
CompletableFuture.supplyAsync(
(Supplier<Set<String>>)
() -> {
try (BufferedReader br =
new BufferedReader(new InputStreamReader(p.getInputStream()))) {
return br.lines()
.filter(l -> !l.contains("jps"))
.map(
l -> {
int idx = l.indexOf(' ');
return l.substring(0, idx);
})
.collect(java.util.stream.Collectors.toSet());
} catch (IOException e) {
log.debug("Unable to list java processes via 'jps'", e);
return Collections.emptySet();
}
});
() -> {
try (BufferedReader br =
new BufferedReader(new InputStreamReader(p.getInputStream()))) {
return br.lines()
.filter(l -> !l.contains("jps"))
.map(
l -> {
int idx = l.indexOf(' ');
return l.substring(0, idx);
})
.collect(java.util.stream.Collectors.toSet());
} catch (IOException e) {
log.debug("Unable to list java processes via 'jps'", e);
return Collections.emptySet();
}
});
if (p.waitFor(500, TimeUnit.MILLISECONDS)) {
if (p.exitValue() == 0) {
return collecting.get();
} else {
log.debug("Execution of 'jps' failed with exit code {}", p.exitValue());
}
} else {
p.destroyForcibly();
log.debug("Execution of 'jps' timed out");
}
} catch (Exception e) {
Expand Down

0 comments on commit 0fa642e

Please sign in to comment.