From 101999044884d85259c1d6ce99dc90645eb43f09 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Fri, 29 Nov 2013 18:42:42 +0100 Subject: [PATCH] e2-cf: use callcmd to start editor Signed-off-by: Tobias Ulmer --- local/e2-cf.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/local/e2-cf.lua b/local/e2-cf.lua index 59fc1f6..880d756 100644 --- a/local/e2-cf.lua +++ b/local/e2-cf.lua @@ -39,17 +39,12 @@ local commands = {} -- @return True on success, false on error. -- @return Error object on failure. local function editor(file) - local e = e2lib.globals.osenv["EDITOR"] - e2lib.shquote(e) - file = e2lib.shquote(file) - - local cmd = string.format("%s %s", e, file) - + local rc, re - local rc - rc = os.execute(cmd) - rc = rc/256 -- XXX: os.execute - if rc ~= 0 then + rc, re = e2lib.callcmd({ e2lib.globals.osenv["EDITOR"] , file }, {}) + if not rc then + return false, re + elseif rc ~= 0 then return false, err.new("Editor finished with exit status %d", rc) end -- 2.39.5