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. --- core/ext/pm/file_browser.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/ext/pm/file_browser.lua') diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua index 9acf9bec..f48c1346 100644 --- a/core/ext/pm/file_browser.lua +++ b/core/ext/pm/file_browser.lua @@ -12,7 +12,9 @@ end function get_contents_for(full_path) local dirpath = table.concat(full_path, '/') - local out = io.popen('ls -1p "'..dirpath..'"'):read('*all') + local p = io.popen('ls -1p "'..dirpath..'"') + local out = p:read('*all') + p:close() if #out == 0 then error('No such directory: '..dirpath) return {} @@ -49,7 +51,9 @@ function perform_menu_action(menu_item, selected_item) textadept.pm.entry_text = filepath textadept.pm.activate() elseif menu_item == 'File Details' then - local out = io.popen('ls -dhl "'..filepath..'"'):read('*all') + local p = io.popen('ls -dhl "'..filepath..'"') + local out = p:read('*all') + p:close() local perms, num_dirs, owner, group, size, mod_date = out:match('^(%S+) (%S+) (%S+) (%S+) (%S+) (%S+ %S)') out = 'File details for:\n'..filepath..'\n'.. -- cgit v1.2.3