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

From: Robert Gieseke <rob.g.att.web.de>
Date: Thu, 04 Sep 2014 18:41:01 +0200

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

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

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?

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?

Thanks!
Robert

-- 
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 - 12:41:01 EDT

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