]> git.e2factory.org Git - e2factory.git/commitdiff
e2option: showtoolmanpage() does return, handle return code correctly
authorTobias Ulmer <tu@emlix.com>
Fri, 22 Nov 2013 11:33:30 +0000 (12:33 +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>
generic/e2option.lua

index 2b1f08e9decbd99de39ce2a807c2eea158657737..6052fd6468d1eb600e745b2a24350de91d39cd61 100644 (file)
@@ -194,7 +194,7 @@ local function defaultoptions()
             e2lib.abort(re)
         end
 
-        e2lib.finish(0)
+        e2lib.finish(rc)
     end,
     category)
 
@@ -416,8 +416,9 @@ function e2option.usage(rc)
     e2lib.finish(rc)
 end
 
---- Show the manpage of the current tool and exit the process.
--- @return This function does not return.
+--- Show the manpage for the current tool
+-- @return Return code of man viewer, or false on error.
+-- @return Error object on failure.
 function e2option.showtoolmanpage()
     local tool = toolname()
     local mpage = e2lib.join('man', 'man1', string.format('%s.1', tool))
@@ -481,9 +482,9 @@ function e2option.showtoolmanpage()
 
     table.insert(cmd, e2lib.shquote(mpage))
 
-    os.execute(table.concat(cmd, ' '))
+    local rc = os.execute(table.concat(cmd, ' '))
 
-    return true
+    return rc/256 -- XXX: os.execute
 end
 
 return strict.lock(e2option)