diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2015-03-14 11:12:58 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2015-03-14 11:12:58 -0400 |
commit | d119507c823f5cbbee37a8872a42be68ad77e307 (patch) | |
tree | 2f0311e4835935af2cc046cf5293af86a8c0d550 | |
parent | bcb277c144c4f4e18c46000e48e37e17b476239a (diff) |
Filter through now uses `spawn()`; modules/textadept/editing.lua
-rw-r--r-- | modules/textadept/editing.lua | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index d344258b..241e3816 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -521,13 +521,9 @@ function M.filter_through(command) else -- use whole buffer as input input = buffer:get_text() end - local tmpfile = _USERHOME..'/.ft' - local f = io.open(tmpfile, 'wb') - f:write(input) - f:close() - local cmd = (not WIN32 and 'cat' or 'type')..' "'..tmpfile..'" | '..command - if WIN32 then cmd = cmd:gsub('/', '\\') end - local p = io.popen(cmd) + local p = spawn(command) + p:write(input) + p:close() if s ~= e then buffer:set_target_range(s, e) buffer:replace_target(p:read('*a')) @@ -536,8 +532,6 @@ function M.filter_through(command) buffer:set_text(p:read('*a')) buffer:goto_pos(s) end - p:close() - os.remove(tmpfile) end --- |