You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/02/03 05:31:01 UTC
[maven-surefire] 01/02: [SUREFIRE-1998] Interrupted PPID Checker should have the same meaning as stopped PPID Checker
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch InterruptedIOException
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit f04e33bc3e7ee156241d02a50b9a33906d5afcbd
Author: Tibor Digaňa <ti...@apache.org>
AuthorDate: Tue Feb 1 15:01:03 2022 +0100
[SUREFIRE-1998] Interrupted PPID Checker should have the same meaning as stopped PPID Checker
---
.../java/org/apache/maven/surefire/booter/PpidChecker.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 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 ff5d77c..a5287c7 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
@@ -35,6 +35,7 @@ import java.util.regex.Pattern;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
+import static java.lang.String.join;
import static java.util.concurrent.TimeUnit.DAYS;
import static java.util.concurrent.TimeUnit.HOURS;
import static java.util.concurrent.TimeUnit.MINUTES;
@@ -397,6 +398,8 @@ final class PpidChecker
Process process = null;
ProcessInfo processInfo = INVALID_PROCESS_INFO;
StringBuilder out = new StringBuilder( 64 );
+ out.append( join( " ", command ) )
+ .append( NL );
try
{
if ( IS_OS_HP_UX ) // force to run shell commands in UNIX Standard mode on HP-UX
@@ -414,13 +417,17 @@ final class PpidChecker
}
checkValid( scanner );
int exitCode = process.waitFor();
- if ( exitCode != 0 || isStopped() )
+ boolean isError = Thread.interrupted() || isStopped();
+ if ( exitCode != 0 || isError )
{
- out.append( "<<exit>> <<" ).append( exitCode ).append( ">>" ).append( NL );
+ out.append( "<<exit>> <<" ).append( exitCode ).append( ">>" )
+ .append( NL )
+ .append( "<<stopped>> <<" ).append( isStopped() ).append( ">>" );
DumpErrorSingleton.getSingleton()
.dumpText( out.toString() );
}
- return isStopped() ? ERR_PROCESS_INFO : exitCode == 0 ? processInfo : INVALID_PROCESS_INFO;
+
+ return isError ? ERR_PROCESS_INFO : ( exitCode == 0 ? processInfo : INVALID_PROCESS_INFO );
}
catch ( Exception e )
{