Skip to content

Commit 9de0dd6

Browse files
committed
Reuse ps for detecting processes but use pipe to find the right one
jps doesnt work well with different users
1 parent 77bfd22 commit 9de0dd6

File tree

1 file changed

+4
-4
lines changed
  • qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker

1 file changed

+4
-4
lines changed

qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/Docker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ public static void waitForElasticsearchToStart() {
186186
// Give the container enough time for security auto-configuration or a chance to crash out
187187
Thread.sleep(STARTUP_SLEEP_INTERVAL_MILLISECONDS);
188188

189-
// Set COLUMNS so that `ps` doesn't truncate its output
190-
psOutput = dockerShell.run("bash -c 'COLUMNS=1000 jdk/bin/jps -ml'").stdout();
191-
192-
if (psOutput.contains("org.elasticsearch.bootstrap.Elasticsearch")) {
189+
// The length of the command exceeds what we can use for COLUMNS so we use a pipe to detect the process we're looking for
190+
psOutput = dockerShell.run("bash -c 'ps -ax | grep org.elasticsearch.bootstrap.Elasticsearch | grep -v grep | wc -l'")
191+
.stdout();
192+
if (psOutput.contains("1")) {
193193
isElasticsearchRunning = true;
194194
break;
195195
}

0 commit comments

Comments
 (0)