protected function checkFileExistence(Api_Console_ConsoleCommandModel $cmd)
 {
     if ($cmd->getStdin()) {
         if (!file_exists($cmd->getStdin())) {
             throw new AppKitException("File " . $cmd->getStdin() . " does not exist");
         }
     }
     if ($cmd->getPipedCmd()) {
         $this->checkFileExistence($cmd->getPipedCmd());
     }
 }
 public function exec(Api_Console_ConsoleCommandModel $cmd)
 {
     $this->connect();
     $cmdString = $cmd->getCommandString();
     $out = $this->resource->exec($cmdString . '; echo -n "|$?"');
     $lines = preg_split('/\\|/', $out);
     $ret = (int) array_pop($lines);
     $out = implode('|', $lines);
     $cmd->setOutput($out);
     $cmd->setReturnCode($ret);
 }