Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell.

Abhijit Halder
2011-08-05T15:05:58Z

Has pexecute deprecated by any chance? There is a comment in the code
advising not to use this function in new code. Further, pexecute does
not provide similar functionality. It just executes a program and
returns the status of the program, not provide the text output from
the program it executes. Is it a good idea to write a function (say,
gdb_popen) as below:

FILE *
gdb_popen (const char *cmd, const char *mode)
{
#ifdef _WIN32
return _popen (cmd, mode);
#else
return popen (cmd, mode);
}

On Thu, Aug 4, 2011 at 7:51 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
>
> I haven't really read this thread yet, but I wanted to chime in...
>
>>> +      pipe->handle = popen (pipe->shell_cmd, pipe->mode);
>
> Pedro> I'm not sure that'll build on all supported hosts.
> Pedro> I think on Windows that may require use of _popen instead.
>
> libiberty has the already-portable 'pexecute' code for this kind of
> thing.
>
> Tom
>