Re: [code] [textadept] Curses `os.spawn` Shell String Parsing

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Fri, 14 Dec 2018 09:19:59 +0000

On Thu, Dec 13, 2018 at 10:17:02PM -0500, Mitchell wrote:
> Hi Chris,
>
> On Thu, 13 Dec 2018, Chris Emerson wrote:
> > On the topic of os.spawn, I've recently got to the bottom of a problem
> > I've had with it: some programs behave differently when they have a pipe
> > as stdin. I keep having ripgrep appearing to hang - it sees a pipe as
> > stdin and assumes it should read from that instead of searching from the
> > current directory.
> >
> > So it would be useful to have an option to set stdin of the spawned
> > process to /dev/null instead of a pipe that won't be used. (I can work
> > around it by indirecting through a one-line shell script, of course).
>
> What happens when you close stdin with `proc:close()`? Do your commands run
> as expected?

In ripgrep's case it would finish immediately instead of hanging, but not as
expected. It inspects stdin (if no filenames supplied) on startup; if it's
a pipe or regular file then it behaves like "grep"; otherwise (e.g.
/dev/null or a terminal) it behaves like "grep -r .".

I will also suggest that ripgrep adds an option to override this behaviour.
:-)

Chris

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Fri 14 Dec 2018 - 04:19:59 EST

This archive was generated by hypermail 2.2.0 : Fri 14 Dec 2018 - 06:50:05 EST