Re: [code] [textadept] Problem with spawn in macOS

From: Mitchell <m.att.foicica.com>
Date: Mon, 6 Nov 2017 09:54:52 -0500 (EST)

Hi Giovanni,

On Mon, 6 Nov 2017, Giovanni Salmeri wrote:

> Hello everybody!
> I have stumbled upon a problem with spawn in macOS.
>
> print(spawn('ls'):read('a'))
>
> works as expected both in Linux and in macOS.
>
> But something like
>
> print(spawn('pandoc -v'):read('a'))
>
> works well in Linux, while in macOS I have 'nil' as result. The same
> not only with pandoc, but also with several other programs. I cannot
> imagine no solution and no workaround... Can anybody help me?
> Thank you very much!

I suspect that `pandoc -v` is returning/exitting too quickly for spawn to read any resulting output from. For non-async commands that you expect to return nearly immediately, stick to Lua's `io.popen()`. In your `ls` example above, there is some I/O done before printing, and that "lag" is probably sufficient enough to allow spawn to do some reading.

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 06 Nov 2017 - 09:54:52 EST

This archive was generated by hypermail 2.2.0 : Tue 07 Nov 2017 - 06:44:27 EST