protected function buildProcess($commandOptions) {
		
		if (is_string($commandOptions)) {
			
			$process = new Process(escapeshellcmd((string) $commandOptions));
			return array("process" => $process, "output" => true);
			
		} else if (is_array($commandOptions)) {
			
			$commandline = escapeshellcmd((string) $commandOptions["command"]);
			$cwd         = isset($commandOptions["cwd"])     ? $commandOptions["cwd"]     : null;
			$env         = isset($commandOptions["env"])     ? $commandOptions["env"]     : null;
			$input       = isset($commandOptions["input"])   ? $commandOptions["input"]   : null;
			$timeout     = isset($commandOptions["timeout"]) ? $commandOptions["timeout"] : null;
			$options     = isset($commandOptions["options"]) ? $commandOptions["options"] : array();
			$idle        = isset($commandOptions["idle"])    ? $commandOptions["idle"]    : null;
			$output      = isset($commandOptions["output"])  ? $commandOptions["output"]  : true;
			
			$process = new Process($commandline, $cwd, $env, $input, $timeout, $options);
			
			// double-check idle
			if (!empty($idle)) {
				$process->setIdleTimeout($idle);
			}
			
			return array("process" => $process, "output" => $output);
			
		}
		
	}