]> git.e2factory.org Git - e2factory.git/commitdiff
e2-cf: use callcmd to start editor
authorTobias Ulmer <tu@emlix.com>
Fri, 29 Nov 2013 17:42:42 +0000 (18:42 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/e2-cf.lua

index 59fc1f626f4ab1083707487ced56d4ddd10d3347..880d756fb9c1887eaed37b8c355d14f8544f55e0 100644 (file)
@@ -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