]> git.e2factory.org Git - e2factory.git/commitdiff
remove e2lib.program_output() and inline its only user
authorTobias Ulmer <tu@emlix.com>
Fri, 18 Jan 2013 16:59:16 +0000 (17:59 +0100)
committerTobias Ulmer <tu@emlix.com>
Tue, 26 Feb 2013 18:07:13 +0000 (19:07 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index 14cbbf60ac90d2e921efda0bc7037f6e5f402d70..c20a9fde4341e6ce2954c96ba4b50a9694870115 100644 (file)
@@ -181,7 +181,13 @@ function e2lib.init()
     end
 
     -- get the host name
-    e2lib.globals.hostname = e2lib.program_output("hostname")
+    local hostname = io.popen("hostname")
+    if not hostname then
+        e2lib.abort("execution of \"hostname\" failed")
+    end
+
+    e2lib.globals.hostname = hostname:read("*a")
+    hostname:close()
     if not e2lib.globals.hostname then
         e2lib.abort("hostname ist not set")
     end
@@ -293,19 +299,6 @@ function e2lib.tracer(event, line)
     end
 end
 
---- return the output of a program, abort if the call fails
--- @param cmd string: the program to call
--- @return string: the program output
-function e2lib.program_output(cmd)
-    local i = io.popen(cmd)
-    if not i then
-        e2lib.abort("invocation of program failed:  ", cmd)
-    end
-    local input = i:read("*a")
-    i:close()
-    return input
-end
-
 --- print a warning, composed by concatenating all arguments to a string
 -- @param ... any number of strings
 -- @return nil