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

From: Mitchell <m.att.foicica.com>
Date: Mon, 17 Dec 2018 13:58:46 -0500 (EST)

Hi Chris,

On Fri, 14 Dec 2018, Chris Emerson wrote:

> 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 .".

Hmm, I think I'd recommend you use your workaround then, as I am unsure how to go about supporting a platform-independent 7th (!!) parameter that would set stdin to the equivalent of Linux /dev/null.

Cheers,
Mitchell

-- 
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 Mon 17 Dec 2018 - 13:58:46 EST

This archive was generated by hypermail 2.2.0 : Tue 18 Dec 2018 - 06:31:19 EST