Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

wait flag

  • Loading branch information...
commit 38ccb86488e8eefbb27068e4e3094eebec1f8039 1 parent dc0ee98
@JPMoresmau authored
View
8 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/scion/ScionManager.java
@@ -187,8 +187,8 @@ public void run() {
boolean doBrowserSetup=true;
boolean ignore=HaskellUIPlugin.getDefault().getPreferenceStore().getBoolean( IPreferenceConstants.IGNORE_TOOOLD_EXECUTABLE );
if (!ignore){
- final boolean buildwrapperVersionOK=serverExecutablePath==null || checkVersion( serverExecutablePath, MINIMUM_BUILDWRAPPER );
- final boolean browserVersionOK=browserExecutablePath==null || checkVersion( browserExecutablePath, MINIMUM_SCIONBROWSER );
+ final boolean buildwrapperVersionOK=serverExecutablePath==null || checkVersion( serverExecutablePath, MINIMUM_BUILDWRAPPER ,true);
+ final boolean browserVersionOK=browserExecutablePath==null || checkVersion( browserExecutablePath, MINIMUM_SCIONBROWSER,false );
doBuildWrapperSetup=buildwrapperVersionOK; // do not launch if too old
doBrowserSetup=browserVersionOK;// do not launch if too old
@@ -427,10 +427,10 @@ private synchronized void serverFactorySetup(){
// }
}
- public static boolean checkVersion(final IPath path,final String minimal){
+ public static boolean checkVersion(final IPath path,final String minimal,final boolean wait){
if (path!=null){
try {
- String currentVersion=ProcessRunner.getExecutableVersion(path.toOSString());
+ String currentVersion=ProcessRunner.getExecutableVersion(path.toOSString(),wait);
if (currentVersion==null){
return false;
}
View
26 net.sf.eclipsefp.haskell.util/src/net/sf/eclipsefp/haskell/util/ProcessRunner.java
@@ -75,23 +75,31 @@ private static Thread redirect( final Reader in, final Writer out, String name )
return new Thread[]{t1,t2};
}
- public static String getExecutableVersion(String path) throws IOException{
+ public static String getExecutableVersion(String path,boolean wait) throws IOException{
File f=new File(path);
if (f.exists()){
StringWriter sw=new StringWriter();
Process p=new ProcessRunner().executeNonblocking(f.getParentFile(), sw, null, f.getAbsolutePath(),"--version");
- for (int a=0;a<50;a++){ // 50 * 100 -> 5 seconds maxi
+ if (wait){
try {
- p.exitValue();
- break;
- } catch (IllegalThreadStateException ise){
- // still running
- }
- try {
- Thread.sleep(100);
+ p.waitFor();
} catch (InterruptedException ie){
//
}
+ } else {
+ for (int a=0;a<50;a++){ // 50 * 100 -> 5 seconds maxi
+ try {
+ p.exitValue();
+ break;
+ } catch (IllegalThreadStateException ise){
+ // still running
+ }
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException ie){
+ //
+ }
+ }
}
try {
String line=sw.toString().trim();
Please sign in to comment.
Something went wrong with that request. Please try again.