diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-04-10 11:01:06 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-04-10 11:01:06 -0400 |
commit | 8f4e032c261e817f939ffd2c65e878d4f6eea0ec (patch) | |
tree | 5cc890b4c3ce4e2b8e58edf1645f1a4ccdcd71cc | |
parent | 2321c7ad5ab98d0be3b932f00bb91601b313cef9 (diff) |
Temporarily disable spawn in OSX due to GLib crashes.
-rw-r--r-- | core/init.lua | 28 | ||||
-rw-r--r-- | modules/textadept/run.lua | 12 |
2 files changed, 22 insertions, 18 deletions
diff --git a/core/init.lua b/core/init.lua index 3ac9d131..f9b6a14c 100644 --- a/core/init.lua +++ b/core/init.lua @@ -16,15 +16,27 @@ keys = require('keys') _M = {} -- language modules table -- LuaJIT compatibility. if jit then module, package.searchers, bit32 = nil, package.loaders, bit end --- curses compatibility. -if CURSES then +-- curses and OSX compatibility. +if CURSES or OSX then + local spawn_ = spawn function spawn(argv, working_dir, stdout_cb, stderr_cb, exit_cb) - local current_dir = lfs.currentdir() - lfs.chdir(working_dir) - local p = io.popen(argv..' 2>&1') - stdout_cb(p:read('*all')) - exit_cb(select(3, p:close())) - lfs.chdir(current_dir) +-- if OSX then +-- -- Workaround for GLib abort caused by failed assertion. +-- local p, err = spawn_(argv, working_dir, stdout_cb, stderr_cb) +-- if not p then return p, err end +-- timeout(1, function() +-- if p:status() == 'running' then return true end +-- exit_cb('Process completed') +-- end) +-- else + local current_dir = lfs.currentdir() + lfs.chdir(working_dir) + local p = io.popen(argv..' 2>&1') + stdout_cb(p:read('*all')) + exit_cb(select(3, p:close())) + lfs.chdir(current_dir) + return p +-- end end end diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index a4b5f189..9a3e561b 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -106,7 +106,7 @@ local function command(commands, event) preferred_view = view local events_emit = events.emit local function emit_output(output) - ui.SILENT_PRINT = true + ui.SILENT_PRINT = not OSX and true for line in output:gmatch('[^\r\n]+') do events_emit(event, data, line:iconv('UTF-8', _CHARSET)) end @@ -116,16 +116,8 @@ local function command(commands, event) if commands == M.build_commands then emit_output('> cd '..cwd) end emit_output('> '..command) - local p, err = spawn(command, cwd, emit_output, emit_output, - not OSX and emit_status or nil) + local p, err = spawn(command, cwd, emit_output, emit_output, emit_status) if not p then error(err) end - if OSX then - -- Workaround for GTKOSX abort caused by failed assertion. - timeout(1, function() - if p:status() == 'running' then return true end - emit_status('Process completed') - end) - end M.proc, M.cwd = p, cwd end |