// Path: heartbeat-common/src/main/java/com/heartbeat/common/board/OperatingSystem.java
// public final class OperatingSystem {
//     private OperatingSystem() {
//     }
// 
//     private static Type os;
// 
//     /**
//      * Detect the operating system from the os.name System property
//      *
//      * @returns - the operating system
//      */
//     public static Type getType() {
//         return getType(false);
//     }
// 
//     /**
//      * Detect the operating system from the os.name System property
//      *
//      * @returns - the operating system
//      */
//     public static Type getType(boolean force) {
//         if (force || os == null) {
//             String osName = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
//             if (osName.contains("nux")) {
//                 OperatingSystem.os = Type.LINUX;
//             } else if (osName.contains("win")) {
//                 OperatingSystem.os = Type.WINDOWS;
//             } else if (osName.contains("mac")) {
//                 OperatingSystem.os = Type.MAC_OS;
//             } else {
//                 OperatingSystem.os = Type.OTHER;
//             }
//         }
//         return os;
//     }
// 
// 
//     /**
//      * Types of Operating Systems and some default values.
//      */
//     public enum Type {
//         WINDOWS(new String[]{"cmd.exe", "/c"}),
//         MAC_OS(new String[]{"bash", "-c"}),
//         LINUX(new String[]{"bash", "-c"}),
//         OTHER(new String[]{"bash", "-c"}); // hope they are linux :D
// 
//         private final String[] cmdPrefix;
// 
//         Type(String[] cmdPrefix) {
//             this.cmdPrefix = cmdPrefix;
//         }
// 
//         /**
//          * returns the pre commands of the OS command line
//          *
//          * @return
//          */
//         public String[] getCmdPrefix() {
//             return Arrays.copyOf(cmdPrefix, 2);
//         }
//     }
// }


import com.heartbeat.common.board.OperatingSystem;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
                result.append(line);
            }

            boolean hasError = false;
            // Collect all the errors to the same builder.
            while ((line = stdError.readLine()) != null) {
                result.append(line);
                hasError = true;
            }

            //Check the exiting code.
            try {
                int niceExit = p.waitFor();
                if (niceExit != 0)
                    hasError = true;
            } catch (InterruptedException e) {
            }
            //In case of error, just merge the outputs together and throw an exception.
            if (hasError) {
                throw new RuntimeCommandException(result.toString());
            }

            return result.toString();

        } catch (IOException e) {
            throw new RuntimeCommandException(e);
        }
    }

    private static Process getOSSpecificProcess(String command) throws IOException {
// Path: heartbeat-common/src/main/java/com/heartbeat/common/board/OperatingSystem.java
// public final class OperatingSystem {
//     private OperatingSystem() {
//     }
// 
//     private static Type os;
// 
//     /**
//      * Detect the operating system from the os.name System property
//      *
//      * @returns - the operating system
//      */
//     public static Type getType() {
//         return getType(false);
//     }
// 
//     /**
//      * Detect the operating system from the os.name System property
//      *
//      * @returns - the operating system
//      */
//     public static Type getType(boolean force) {
//         if (force || os == null) {
//             String osName = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
//             if (osName.contains("nux")) {
//                 OperatingSystem.os = Type.LINUX;
//             } else if (osName.contains("win")) {
//                 OperatingSystem.os = Type.WINDOWS;
//             } else if (osName.contains("mac")) {
//                 OperatingSystem.os = Type.MAC_OS;
//             } else {
//                 OperatingSystem.os = Type.OTHER;
//             }
//         }
//         return os;
//     }
// 
// 
//     /**
//      * Types of Operating Systems and some default values.
//      */
//     public enum Type {
//         WINDOWS(new String[]{"cmd.exe", "/c"}),
//         MAC_OS(new String[]{"bash", "-c"}),
//         LINUX(new String[]{"bash", "-c"}),
//         OTHER(new String[]{"bash", "-c"}); // hope they are linux :D
// 
//         private final String[] cmdPrefix;
// 
//         Type(String[] cmdPrefix) {
//             this.cmdPrefix = cmdPrefix;
//         }
// 
//         /**
//          * returns the pre commands of the OS command line
//          *
//          * @return
//          */
//         public String[] getCmdPrefix() {
//             return Arrays.copyOf(cmdPrefix, 2);
//         }
//     }
// }


// Path: heartbeat-common/src/main/java/com/heartbeat/common/cli/RuntimeCommandExec.java
import com.heartbeat.common.board.OperatingSystem;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

                result.append(line);
            }

            boolean hasError = false;
            // Collect all the errors to the same builder.
            while ((line = stdError.readLine()) != null) {
                result.append(line);
                hasError = true;
            }

            //Check the exiting code.
            try {
                int niceExit = p.waitFor();
                if (niceExit != 0)
                    hasError = true;
            } catch (InterruptedException e) {
            }
            //In case of error, just merge the outputs together and throw an exception.
            if (hasError) {
                throw new RuntimeCommandException(result.toString());
            }

            return result.toString();

        } catch (IOException e) {
            throw new RuntimeCommandException(e);
        }
    }

    private static Process getOSSpecificProcess(String command) throws IOException {
        ProcessBuilder pb = new ProcessBuilder(OperatingSystem.getType().getCmdPrefix());