From d119507c823f5cbbee37a8872a42be68ad77e307 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 14 Mar 2015 11:12:58 -0400 Subject: Filter through now uses `spawn()`; modules/textadept/editing.lua --- modules/textadept/editing.lua | 12 +++--------- 1 file 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 --- -- cgit v1.2.3