This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch docker-alpine
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/docker-alpine by this push:
     new 1316bf8  "-p" in "ps" not supported on Docker Alpine Linux
1316bf8 is described below

commit 1316bf8357bb17316fbe8e602fa7c279fb96c370
Author: tibordigana <tibordig...@apache.org>
AuthorDate: Sun Oct 20 01:38:11 2019 +0200

    "-p" in "ps" not supported on Docker Alpine Linux
---
 .../main/java/org/apache/maven/surefire/booter/PpidChecker.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git 
a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java
 
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java
index 60b6669..1535566 100644
--- 
a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java
+++ 
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java
@@ -39,9 +39,7 @@ import static java.util.concurrent.TimeUnit.MINUTES;
 import static java.util.regex.Pattern.compile;
 import static org.apache.commons.io.IOUtils.closeQuietly;
 import static org.apache.commons.lang3.StringUtils.isNotBlank;
-import static org.apache.commons.lang3.SystemUtils.IS_OS_HP_UX;
-import static org.apache.commons.lang3.SystemUtils.IS_OS_UNIX;
-import static org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS;
+import static org.apache.commons.lang3.SystemUtils.*;
 import static org.apache.maven.surefire.booter.ProcessInfo.unixProcessInfo;
 import static org.apache.maven.surefire.booter.ProcessInfo.windowsProcessInfo;
 import static org.apache.maven.surefire.booter.ProcessInfo.ERR_PROCESS_INFO;
@@ -181,8 +179,8 @@ final class PpidChecker
                 return previousOutputLine;
             }
         };
-
-        return reader.execute( "/bin/sh", "-c", unixPathToPS() + " -o etime= 
-p " + ppid );
+        String cmd = unixPathToPS() + " -o etime= " + ( IS_OS_LINUX ? "" : "-p 
" ) + ppid;
+        return reader.execute( "/bin/sh", "-c", cmd );
     }
 
     ProcessInfo windows()

Reply via email to