String (@NotNull OS os, int exitCode) { StringBuilder result = new StringBuilder(); result.append(exitCode); if (os.getPlatform() == Platform.WINDOWS && exitCode >= 0xC0000000 && exitCode < 0xD0000000) { // 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". result.append(" (0x").append(StringUtil.toUpperCase(Integer.toHexString(exitCode))); if (exitCode == 0xC000013A) { result.append(": interrupted by Ctrl+C"); } result.append(')'); } else if (os.getPlatform() == Platform.UNIX) { boolean isDarwin = os == OS.macOS; var signal = UnixSignal.fromExitCode(isDarwin, exitCode); if (signal != null) { result.append(" (interrupted by signal ").append(signal.getSignalNumber(isDarwin)).append(":").append(signal.name()).append(')'); } } return result.toString(); }