Пример #1
0
int _pipe(char **head_tail)//, bool _hasPipe)
{
  int status, pid, pd[2];

  pipe(pd);
  pid = fork();

  if(pid) { // reader is the parent
    close(pd[1]); // close READING head
    close(0); // close current WRITING head
    dup(pd[0]); // allows writing to PIPE
    //printf("\033[1mWriting to Pipe: \'%s\'\n\033[0m", head_tail[1]);
    tryExec(head_tail[1], TRUE);
  }
  else { // writer is the child
    //printf("\033[1;32m[pid:%d] forks child [pid:%d] for PIPE.\n\033[0m", getppid(), getpid());
    close(pd[0]); // close WRITING head
    close(1); // close current READING head
    dup(pd[1]); // replace 0 with pd[0], allows reading from PIPE
    //printf("\033[1mWriting to Pipe: \'%s\'\n\033[0m", head_tail[0]);
    _execAt(head_tail[0]);
  }
}
bool Debugger::isInstalled() const
{
    QString tryexec = tryExec();
    return !tryexec.isEmpty() && !QStandardPaths::findExecutable(tryexec).isEmpty();
}