mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CR-IC-4179 (cleanup)
This commit is contained in:
+17
-19
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,12 +28,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author dyoma
|
||||
*/
|
||||
public class ProcessTerminatedListener extends ProcessAdapter {
|
||||
@NonNls protected static final String EXIT_CODE_ENTRY = "$EXIT_CODE$";
|
||||
@NonNls protected static final String EXIT_CODE_REGEX = "\\$EXIT_CODE\\$";
|
||||
|
||||
private static final Key<ProcessTerminatedListener> KEY = new Key<ProcessTerminatedListener>("processTerminatedListener");
|
||||
|
||||
private final String myProcessFinishedMessage;
|
||||
private final Project myProject;
|
||||
@NonNls protected static final String EXIT_CODE_ENTRY = "$EXIT_CODE$";
|
||||
@NonNls
|
||||
protected static final String EXIT_CODE_REGEX = "\\$EXIT_CODE\\$";
|
||||
|
||||
private ProcessTerminatedListener(final Project project, final String processFinishedMessage) {
|
||||
myProject = project;
|
||||
@@ -76,24 +77,21 @@ public class ProcessTerminatedListener extends ProcessAdapter {
|
||||
|
||||
@NotNull
|
||||
private static String stringifyExitCode(int exitCode) {
|
||||
if (SystemInfo.isWindows) {
|
||||
// Quote from http://support.microsoft.com/kb/308558:
|
||||
// If the result code has the "C0000XXX" format, the task did not complete successfully (the "C" indicates an error condition).
|
||||
// The most common "C" error code is "0xC000013A: The application terminated as a result of a CTRL+C".
|
||||
String hex = Integer.toHexString(exitCode).toUpperCase();
|
||||
if (hex.startsWith("C")) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append(exitCode);
|
||||
result.append(" (0x").append(hex);
|
||||
// reporting a detailed reason for a well-known exit code
|
||||
if ("C000013A".equals(hex)) {
|
||||
result.append(": as a result of a CTRL+C");
|
||||
}
|
||||
result.append(")");
|
||||
return result.toString();
|
||||
if (SystemInfo.isWindows && exitCode <= 0xC0000000 && exitCode > 0xD0000000) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append(exitCode);
|
||||
result.append(" (0x").append(Integer.toHexString(exitCode).toUpperCase());
|
||||
if (exitCode == 0xC000013A) {
|
||||
// reporting a detailed reason for a well-known exit code
|
||||
result.append(": interrupted by CTRL+C");
|
||||
}
|
||||
result.append(")");
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
return String.valueOf(exitCode);
|
||||
}
|
||||
|
||||
return String.valueOf(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user