From a39071a5d25a6b789ed4b241c7f55ffeaf857032 Mon Sep 17 00:00:00 2001
From: Daniel Ratiu <ratiu@fortiss.org>
Date: Thu, 3 Jan 2013 16:35:24 +0000
Subject: [PATCH] exit codes of processes running external tools are now
 considered refs 1106

---
 .../tooling/base/utils/SystemUtils.java       | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java

diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java
new file mode 100644
index 000000000..753b3e9e5
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java
@@ -0,0 +1,51 @@
+/*--------------------------------------------------------------------------+
+$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
+|                                                                          |
+| Copyright 2013 ForTISS GmbH                     |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.utils;
+
+/**
+ * Utility functions that deal with the underlying system.
+ * 
+ * @author ratiu
+ * @author $Author: hoelzl $
+ * @version $Rev: 18709 $
+ * @ConQAT.Rating RED Hash:
+ */
+public class SystemUtils {
+
+	/** Returns true if we are in a Windows system. */
+	public static boolean isWindowsOperatingSystem() {
+		return System.getProperty("os.name").startsWith("Windows");
+	}
+
+	/**
+	 * Converts an integer value representing an error into a string. If the exit code cannot be
+	 * interpreted, then an empty string is returned.
+	 */
+	public static String interpretProcessExitValues(int exitValue) {
+		if(!isWindowsOperatingSystem()) {
+			switch(exitValue) {
+				case 126:
+					return "Command not found";
+				case 139:
+					return "Segmentation fault";
+			}
+		}
+		return "";
+	}
+
+}
-- 
GitLab