diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2015-11-21 16:57:19 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2015-11-21 16:57:19 +0100 |
commit | 8401067436d466b62459283139aa5f7bdf5be0c8 (patch) | |
tree | e4ba77b39dc3c3fe6eb5f3a66513afb32c5990ca /lualibs-os.lua | |
parent | 13e578a1d0f803d8ec7d42d70bb6f773a44e84b0 (diff) | |
parent | 7d8afd6591e978a6a85bf29bbcdbeb3e3936d4d5 (diff) | |
download | lualibs-8401067436d466b62459283139aa5f7bdf5be0c8.tar.gz |
Merge pull request #27 from phi-gamma/master
latest changes
Diffstat (limited to 'lualibs-os.lua')
-rw-r--r-- | lualibs-os.lua | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lualibs-os.lua b/lualibs-os.lua index 1dff79c..0a86ea6 100644 --- a/lualibs-os.lua +++ b/lualibs-os.lua @@ -25,8 +25,6 @@ if not modules then modules = { } end modules ['l-os'] = { -- os.sleep() => socket.sleep() -- math.randomseed(tonumber(string.sub(string.reverse(tostring(math.floor(socket.gettime()*10000))),1,6))) --- maybe build io.flush in os.execute - local os = os local date, time = os.date, os.time local find, format, gsub, upper, gmatch = string.find, string.format, string.gsub, string.upper, string.gmatch @@ -118,15 +116,11 @@ end -- end of environment hack -local execute, spawn, exec, iopopen, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.popen, io.flush - -function os.execute(...) ioflush() return execute(...) end -function os.spawn (...) ioflush() return spawn (...) end -function os.exec (...) ioflush() return exec (...) end -function io.popen (...) ioflush() return iopopen(...) end +local execute = os.execute +local iopopen = io.popen function os.resultof(command) - local handle = io.popen(command,"r") + local handle = iopopen(command,"r") -- already has flush if handle then local result = handle:read("*all") or "" handle:close() @@ -160,7 +154,7 @@ local launchers = { } function os.launch(str) - os.execute(format(launchers[os.name] or launchers.unix,str)) + execute(format(launchers[os.name] or launchers.unix,str)) end if not os.times then -- ? @@ -355,6 +349,8 @@ else end +os.newline = name == "windows" and "\013\010" or "\010" -- crlf or lf + function resolvers.bits(t,k) local bits = find(os.platform,"64",1,true) and 64 or 32 os.bits = bits |