diff options
author | 2008-02-10 21:31:53 -0500 | |
---|---|---|
committer | 2008-02-10 21:31:53 -0500 | |
commit | 2a8b91209627608fe61c21ec96de31b7fffcea94 (patch) | |
tree | 039767373d0a3f688c86cc8c1692fc422b80696d /modules/textadept/macros.lua | |
parent | 655d3222b8e242bcdb96e9458dc311aee1a658e5 (diff) | |
download | textadept-2a8b91209627608fe61c21ec96de31b7fffcea94.tar.gz textadept-2a8b91209627608fe61c21ec96de31b7fffcea94.zip |
Instead of io.popen():read(), a file descriptor is kept and close()'d afterward.
Diffstat (limited to 'modules/textadept/macros.lua')
-rw-r--r-- | modules/textadept/macros.lua | 12 |
1 files changed, 8 insertions, 4 deletions
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 |