aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--core/init.lua27
-rw-r--r--modules/textadept/run.lua2
2 files changed, 10 insertions, 19 deletions
diff --git a/core/init.lua b/core/init.lua
index a243a455..50289ce0 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -16,22 +16,14 @@ keys = require('keys')
_M = {} -- language modules table
-- LuaJIT compatibility.
if jit then module, package.searchers, bit32 = nil, package.loaders, bit end
--- OSX and pdcurses compatibility.
-if OSX or (CURSES and WIN32) then
--- local spawn_ = spawn
+-- pdcurses compatibility.
+if CURSES and WIN32 then
function spawn(argv, working_dir, stdout_cb, stderr_cb, exit_cb)
--- -- 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)
local current_dir = lfs.currentdir()
- lfs.chdir(working_dir)
+ if working_dir then lfs.chdir(working_dir) end
local p = io.popen(argv..' 2>&1')
- stdout_cb(p:read('*a'))
- exit_cb(select(3, p:close()))
+ if stdout_cb then stdout_cb(p:read('*a')) end
+ if exit_cb then exit_cb(select(3, p:close())) else p:close() end
lfs.chdir(current_dir)
return p
end
@@ -148,8 +140,8 @@ local timeout
---
-- Spawns an interactive child process *argv* in a separate thread, returning
-- a handle to that process.
--- At the moment, the Mac OSX GUI version and Win32 terminal version spawn
--- processes in the same thread.
+-- At the moment, only the Win32 terminal version spawns processes in the same
+-- thread.
-- @param argv A command line string containing the program's name followed by
-- arguments to pass to it. `PATH` is searched for program names.
-- @param working_dir Optional current working directory (cwd) for the child
@@ -158,9 +150,8 @@ local timeout
-- block of standard output read from the child. Stdout is read asynchronously
-- in 1KB or 0.5KB blocks (depending on the platform), or however much data is
-- available at the time.
--- At the moment, the Mac OSX GUI version and Win32 terminal version send all
--- output, whether it be stdout or stderr, to this callback after the process
--- finishes.
+-- At the moment, only the Win32 terminal version sends all output, whether it
+-- be stdout or stderr, to this callback after the process finishes.
-- @param stderr_cb Optional Lua function that accepts a string parameter for a
-- block of standard error read from the child. Stderr is read asynchronously
-- in 1KB or 0.5kB blocks (depending on the platform), or however much data is
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 7c1c62b3..b756f76e 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -104,7 +104,7 @@ local function command(commands, event)
preferred_view = view
local events_emit = events.emit
local function emit_output(output, focus)
- ui.SILENT_PRINT = not focus and not OSX and true
+ ui.SILENT_PRINT = not focus
for line in output:gmatch('[^\r\n]+') do
events_emit(event, data, line:iconv('UTF-8', _CHARSET))
end