Re: [code] [textadept] Spawn workaround and OS X/Curses

From: Mitchell <m.att.foicica.com>
Date: Thu, 4 Sep 2014 13:23:41 -0400 (Eastern Daylight Time)

Hi Robert,

On Thu, 4 Sep 2014, Robert Gieseke wrote:

> Hi,
>
> the OS X (and Curses on Windows) workaround function currently doesn't
> handle being called with a single argument. This breaks opening the
> maual html pages for example.
>
> Maybe it could look like (core/init.lua l.30):
>
> local current_dir = lfs.currentdir()
> if working_dir then lfs.chdir(working_dir) end
> local p = io.popen(argv..' 2>&1')
> if stdout_cb then stdout_cb(p:read('*a')) end
> if exit_cb then exit_cb(select(3, p:close())) end
> lfs.chdir(current_dir)
> return p

Thanks, I'll apply this.

> Not sure whether this is a good solution since closing 'p' is dealt with
> depending on arguments being used or not.

When p is garbage collected, it will be automatically closed.

> Another problem, reading command line tool output like ctags or git
> using `spawn` works fine on Linux and OS X (with this workaround) but
> not in the terminal versions. Running scripts (via ctrl-r) works fine.
>
> Something like
> […]
> local p = spawn('git ls-files')
> for line in p:read('*all'):gmatch('[^\r\n]+') do
> files[#files + 1] = line
> end
>
> shows only the first line in the curses version but works fine in the
> GUI apps. Any ideas?

I think this is a bug in lspawn. I should have it fixed in the next
nightly.

> In general it would be no problem to use io.popen but this causes the
> flashing black boxes on Windows.
>
> Last question, if spawn works in the OS X terminal version, could
> something similar work for the OS X GUI version? The 'lspawn' readme
> mentions POSIX and GTK as options, wasn't it the GTK combination with OS
> X being problematic? Could the POSIX variant work?

I never thought about that. I'll look into this; it might very well work.

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 Thu 04 Sep 2014 - 13:23:41 EDT

This archive was generated by hypermail 2.2.0 : Fri 05 Sep 2014 - 06:32:09 EDT