Link to home
Start Free TrialLog in
Avatar of gmeltsin
gmeltsin

asked on

waitFor() never returns after creation of a process with Runtime.exec

when I create a process with Runtime.exec, waitFor() never
returns

im trying to use cvs to check out a project. im calling the process from java. app is running on Unix - Solaris. if one file is specified for check out - it's fine
if whole project is not
code :
...............................................................................
p =
Runtime.getRuntime().exec("cvs checkout FipWAR")


try {
if (isOSWindows() == false)
p.waitFor();//hangs over here - never returns
} catch (InterruptedException e) {
p.destroy();
}
............................................................

thank you

Avatar of Ralf Klatt
Ralf Klatt
Flag of Germany image

Hi,

You may try it this way:


        fname = "cvs checkout FipWAR";
        boolean isOsWindows = Env.isOsWindows();

        try
        {
           if (!isOsWindows)
           {
                Process t = Runtime.getRuntime().exec(fname)
                t.waitFor();
            }
        }
        catch(Exception e){
            System.out.println("Error: " +e);
            return "Error";
        }



Best regards, Raisor
ASKER CERTIFIED SOLUTION
Avatar of jimmack
jimmack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial