public static int spawn_in_out_err_wait(String command, String infile, String outfile,
			String errfile, boolean wait) {
		Process p;

		try {
			p = Runtime.getRuntime().exec(command);
		} catch (IOException e) {
			return -1;
		}

		try {
			if (infile != null) {
				(new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
			}
			if (outfile != null) {
				(new Xfer(p.getInputStream(), new FileOutputStream(outfile))).start();
			}
			if (errfile != null) {
				(new Xfer(p.getErrorStream(), new FileOutputStream(errfile))).start();
			}
			if (wait)
				return p.waitFor();
			else
				return 0;
		} catch (FileNotFoundException e) {
			return -2;
		} catch (InterruptedException e) {
			return -4;
		}
	}