aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/init.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2014-04-10 11:01:06 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2014-04-10 11:01:06 -0400
commit8f4e032c261e817f939ffd2c65e878d4f6eea0ec (patch)
tree5cc890b4c3ce4e2b8e58edf1645f1a4ccdcd71cc /core/init.lua
parent2321c7ad5ab98d0be3b932f00bb91601b313cef9 (diff)
Temporarily disable spawn in OSX due to GLib crashes.
Diffstat (limited to 'core/init.lua')
-rw-r--r--core/init.lua28
1 files changed, 20 insertions, 8 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