better cmd toString
This commit is contained in:
		
							parent
							
								
									d53c03ec3d
								
							
						
					
					
						commit
						d0e4824949
					
				| @ -22,7 +22,6 @@ import java.io.File; | |||||||
| import java.io.FileNotFoundException; | import java.io.FileNotFoundException; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| 
 | 
 | ||||||
| import java.util.Arrays; |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| @ -101,6 +100,17 @@ public class VMControlLibrary { | |||||||
|         return getLib(LIBCRYPTO); |         return getLib(LIBCRYPTO); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     private static String toString(String[] args) { | ||||||
|  |         StringBuffer cmd = new StringBuffer(); | ||||||
|  |         for (int i=0; i<args.length; i++) { | ||||||
|  |             if (cmd.length() != 0) { | ||||||
|  |                 cmd.append(' '); | ||||||
|  |             } | ||||||
|  |             cmd.append("'").append(args[i]).append("'"); | ||||||
|  |         } | ||||||
|  |         return cmd.toString(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private static void exec(String[] args) |     private static void exec(String[] args) | ||||||
|         throws IOException { |         throws IOException { | ||||||
| 
 | 
 | ||||||
| @ -109,14 +119,14 @@ public class VMControlLibrary { | |||||||
|             int exitVal = proc.waitFor(); |             int exitVal = proc.waitFor(); | ||||||
|             if (exitVal != 0) { |             if (exitVal != 0) { | ||||||
|                 String msg = |                 String msg = | ||||||
|                     "exec" + Arrays.asList(args) + |                     "exec(" + toString(args) + | ||||||
|                     " failed: " + exitVal; |                     ") failed: " + exitVal; | ||||||
|                 throw new IOException(msg); |                 throw new IOException(msg); | ||||||
|             } |             } | ||||||
|         } catch (InterruptedException e) { |         } catch (InterruptedException e) { | ||||||
|         } |         } | ||||||
|         if (isDebug) { |         if (isDebug) { | ||||||
|             System.out.println("exec" + Arrays.asList(args) + " OK"); |             System.out.println("exec(" + toString(args) + ") OK"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Doug MacEachern
						Doug MacEachern