Here you can find the source of executeGetStatus(ProcessBuilder pb)
public static int executeGetStatus(ProcessBuilder pb)
//package com.java2s; //License from project: Apache License import java.io.IOException; public class Main { public static int executeGetStatus(ProcessBuilder pb) { Process process;//from www. j a va 2s . c o m try { process = pb.start(); return processWaitGetStatus(process); } catch (IOException e) { return -1; } } private static int processWaitGetStatus(Process process) { int rc = -1; boolean blocked = true; while (blocked) { try { rc = process.waitFor(); blocked = false; } catch (InterruptedException consumed) { // just continue to wait } } return rc; } }