Index: trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/shell/GShell.java	(revision 6181)
+++ trunk/gli/src/org/greenstone/gatherer/shell/GShell.java	(revision 6182)
@@ -140,34 +140,34 @@
      */
     /* private void removeGShellListener(GShellListener listener) {
-	listeners.remove(GShellListener.class, listener);
-	} */
+       listeners.remove(GShellListener.class, listener);
+       } */
+
     /** Any threaded class must include this method to allow the thread body to be run. */
-	public void run() {
-		if(progress != null) {
-		    progress.start();
-		}
-		// Determine if the user has asked for an outfile.
-		String out_name = null;
-		BufferedOutputStream bos = null;
-		if(type == IMPORT || type == BUILD) {
-		    if(type == IMPORT) {
-			out_name = (String) Gatherer.c_man.getCollection().build_options.getImportValue("out");
-		    }
-		    else {
-			out_name = (String) Gatherer.c_man.getCollection().build_options.getBuildValue("out");
-		    }
-		    if(out_name != null && out_name.length() > 0) {
-			try {
-			    bos = new BufferedOutputStream(new FileOutputStream(new File(out_name), true));
-			}
-			catch (Exception error) {
-			    Gatherer.printStackTrace(error);
-			}
-		    }
-		}
-		// Issue a processBegun event
-		fireProcessBegun(type, status);
+    public void run() {
+	if(progress != null) {
+	    progress.start();
+	}
+	// Determine if the user has asked for an outfile.
+	String out_name = null;
+	BufferedOutputStream bos = null;
+	if(type == IMPORT || type == BUILD) {
+	    if(type == IMPORT) {
+		out_name = (String) Gatherer.c_man.getCollection().build_options.getImportValue("out");
+	    }
+	    else {
+		out_name = (String) Gatherer.c_man.getCollection().build_options.getBuildValue("out");
+	    }
+	    if(out_name != null && out_name.length() > 0) {
 		try {
-
+		    bos = new BufferedOutputStream(new FileOutputStream(new File(out_name), true));
+		}
+		catch (Exception error) {
+		    Gatherer.printStackTrace(error);
+		}
+	    }
+	}
+	// Issue a processBegun event
+	fireProcessBegun(type, status);
+	try {
 	    String command = "";
 	    for(int i = 0; i < args.length; i++) {
@@ -176,5 +176,5 @@
 	    ///ystem.err.println("Command: " + command);
 	    fireMessage(type, Dictionary.get("GShell.Command") + ": " + command, status);
-
+	    
 	    Runtime rt = Runtime.getRuntime();
 	    Process prcs = rt.exec(args);
@@ -184,5 +184,5 @@
 	    //BufferedReader stdinbr = new BufferedReader( stdinisr );
 	    // Captures the std err of a program and pipes it into std in of java
-
+	    
 	    StringBuffer eline_buffer = new StringBuffer();
 	    StringBuffer stdline_buffer = new StringBuffer();
@@ -241,78 +241,80 @@
 		}
 	    }
-
-			// Of course, just because the process is finished doesn't mean the incoming streams are empty. Unfortunately I've got no chance of preserving order, so I'll process the error stream first, then the out stream
-			while(eisr.ready()) {
-				int c = eisr.read();
-				///atherer.println("eisr: '" + (char) c + "'");
-				if(c == '\n' || c == '\r') {
-					if(eline_buffer.length() > 0) {
-						String eline = eline_buffer.toString();
-						///atherer.println("* " + eline + " *");
-						if(progress != null) {
-							progress.parse(eline);
-						}
-						if(bos != null) {
-							try {
-								bos.write(eline.getBytes(), 0, eline.length());
-							}
-							catch(Exception error) {
-								Gatherer.printStackTrace(error);
-							}
-						}
-						fireMessage(type, typeAsString(type) + "> " + eline, status);
-						eline = null;
-						eline_buffer = new StringBuffer();
-					}
-				}
-				else {
-					eline_buffer.append((char)c);
-				}
-			}
-			while(stdisr.ready()) {
-				int c = stdisr.read();
-				///atherer.println("eisr: '" + (char) c + "'");
-				if(c == '\n' || c == '\r') {
-					if(stdline_buffer.length() > 0) {
-						String stdline = stdline_buffer.toString();
-						///atherer.println("+ " + stdline + " +");
-						fireMessage(type, typeAsString(type) + "> " + stdline, status);
-						stdline = null;
-						stdline_buffer = new StringBuffer();
-					}
-				}
-				else {
-					stdline_buffer.append((char)c);
-				}
-			}
-
-		// Ensure that any messages still remaining in the string buffers are fired off.
-		if(eline_buffer.length() > 0) {
+	    
+	    // Of course, just because the process is finished doesn't mean the incoming streams are empty. Unfortunately I've got no chance of preserving order, so I'll process the error stream first, then the out stream
+	    while(eisr.ready()) {
+		int c = eisr.read();
+		///atherer.println("eisr: '" + (char) c + "'");
+		if(c == '\n' || c == '\r') {
+		    if(eline_buffer.length() > 0) {
 			String eline = eline_buffer.toString();
+			///atherer.println("* " + eline + " *");
 			if(progress != null) {
-				progress.parse(eline);
+			    progress.parse(eline);
 			}
 			if(bos != null) {
-				try {
-					bos.write(eline.getBytes(), 0, eline.length());
-				}
-				catch(Exception error) {
-					Gatherer.printStackTrace(error);
-				}
+			    try {
+				bos.write(eline.getBytes(), 0, eline.length());
+			    }
+			    catch(Exception error) {
+				Gatherer.printStackTrace(error);
+			    }
 			}
 			fireMessage(type, typeAsString(type) + "> " + eline, status);
 			eline = null;
-		}
-
-		if(stdline_buffer.length() > 0) {
+			eline_buffer = new StringBuffer();
+		    }
+		}
+		else {
+		    eline_buffer.append((char)c);
+		}
+	    }
+	    while(stdisr.ready()) {
+		int c = stdisr.read();
+		///atherer.println("eisr: '" + (char) c + "'");
+		if(c == '\n' || c == '\r') {
+		    if(stdline_buffer.length() > 0) {
 			String stdline = stdline_buffer.toString();
+			///atherer.println("+ " + stdline + " +");
 			fireMessage(type, typeAsString(type) + "> " + stdline, status);
 			stdline = null;
-		}
-
+			stdline_buffer = new StringBuffer();
+		    }
+		}
+		else {
+		    stdline_buffer.append((char)c);
+		}
+	    }
+	    
+	    // Ensure that any messages still remaining in the string buffers are fired off.
+	    if(eline_buffer.length() > 0) {
+		String eline = eline_buffer.toString();
+		///atherer.println("Last bit of eline: " + eline);
+		if(progress != null) {
+		    progress.parse(eline);
+		}
+		if(bos != null) {
+		    try {
+			bos.write(eline.getBytes(), 0, eline.length());
+		    }
+		    catch(Exception error) {
+			Gatherer.printStackTrace(error);
+		    }
+		}
+		fireMessage(type, typeAsString(type) + "> " + eline, status);
+		eline = null;
+	    }
+	    
+	    if(stdline_buffer.length() > 0) {
+		String stdline = stdline_buffer.toString();
+		///atherer.println("Last bit of stdline: " + stdline);
+		fireMessage(type, typeAsString(type) + "> " + stdline, status);
+		stdline = null;
+	    }
+	    
 	    if(!hasSignalledStop()) {
 		// Now display final message based on exit value
 		prcs.waitFor();
-
+		
 		if(prcs.exitValue() == 0) {
 		    status = OK;
