From 2a8b91209627608fe61c21ec96de31b7fffcea94 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 10 Feb 2008 21:31:53 -0500 Subject: Instead of io.popen():read(), a file descriptor is kept and close()'d afterward. --- modules/textadept/macros.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'modules/textadept/macros.lua') diff --git a/modules/textadept/macros.lua b/modules/textadept/macros.lua index 20cf1272..1502d5d5 100644 --- a/modules/textadept/macros.lua +++ b/modules/textadept/macros.lua @@ -66,8 +66,10 @@ function stop_recording() recording = false local textadept = textadept local bf, bp = textadept.buffer_functions, textadept.buffer_properties - local macro_name = - io.popen('zenity --entry --text "Macro name:"'):read('*all'):sub(1, -2) + local p = io.popen('zenity --entry --text "Macro name:"') + local macro_name = p:read('*all'):sub(1, -2) + p:close() + if #macro_name > 0 then for _, command in ipairs(current) do command.type = 'function' @@ -105,8 +107,10 @@ function play(macro_name) if not macro_name then local macro_list = '' for name in pairs(list) do macro_list = macro_list..name..' ' end - macro_name = io.popen('zenity --list --text "Select a Macro" '.. - '--column Name '..macro_list):read('*all'):sub(1, -2) + local p = io.popen('zenity --list --text "Select a Macro" --column Name '.. + macro_list) + macro_name = p:read('*all'):sub(1, -2) + p:close() end local macro = list[macro_name] if not macro then return end -- cgit v1.2.3