Search in sources :

Example 1 with OperatingSystemFamily

use of org.ow2.proactive.utils.OperatingSystemFamily in project scheduling by ow2-proactive.

the class JavaSpawnExecutable method getNativeExecLauncher.

/**
 * Returns the path to the native launcher script In case of Native
 * Executable normal termination test, we use a set of alternate scripts
 * which will not run a detached executable
 *
 * @param alternate
 *            to use alternate scripts
 */
public String[] getNativeExecLauncher(boolean alternate) throws Exception {
    String osName = System.getProperty("os.name");
    OperatingSystem operatingSystem = OperatingSystem.resolveOrError(osName);
    OperatingSystemFamily family = operatingSystem.getFamily();
    String[] nativeExecLauncher = null;
    switch(family) {
        case LINUX:
        case UNIX:
        case MAC:
            String executable = null;
            if (alternate) {
                executable = getExecutablePath(nativeLinuxExecLauncher2).getName();
            } else {
                executable = getExecutablePath(nativeLinuxExecLauncher).getName();
            }
            // TODO runAsMe mode for this Test
            nativeExecLauncher = new String[] { "/bin/sh", executable };
            break;
        case WINDOWS:
            if (alternate) {
                nativeExecLauncher = new String[] { "cmd.exe", "/C", getExecutablePath(nativeWindowsExecLauncher2).getName() };
            } else {
                nativeExecLauncher = new String[] { "cmd.exe", "/C", getExecutablePath(nativeWindowsExecLauncher).getName() };
            }
    }
    return nativeExecLauncher;
}
Also used : OperatingSystem(org.ow2.proactive.utils.OperatingSystem) OperatingSystemFamily(org.ow2.proactive.utils.OperatingSystemFamily)

Aggregations

OperatingSystem (org.ow2.proactive.utils.OperatingSystem)1 OperatingSystemFamily (org.ow2.proactive.utils.OperatingSystemFamily)1