Commit 6369a766 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

use lua-posix rather than lua-signal

parent 3e98b634
......@@ -8,7 +8,10 @@ See LICENSE file for license details
get_opts = require('alt_getopt').get_opts
lpc = require('lpc')
signal = require('signal')
posix = require('posix')
signal = posix.signal
stringy = require('stringy')
function help()
......@@ -276,7 +279,7 @@ if not call(
if mode == 'dump' then dump(level)
elseif mode == 'diff' then
if not require('posix').stat(dumpfile) then
if not posix.stat(dumpfile) then
io.stderr:write('Please translate or activate first\n')
os.exit(1)
end
......@@ -304,15 +307,15 @@ if not call(
local pid, interrupted
if not force then
signal.signal(
'SIGCHLD',
signal(
posix.SIGCHLD,
function()
if pid and lpc.wait(pid, 1) then os.exit(2) end
end
)
for i, sig in ipairs({'INT', 'TERM'}) do
signal.signal(
'SIG'..sig,
signal(
posix['SIG'..sig],
function()
interrupted = true
io.stdin:close()
......@@ -327,8 +330,8 @@ if not call(
end
local function kill()
signal.signal('SIGCHLD', 'default')
signal.kill(pid, 'SIGTERM')
signal(posix.SIGCHLD, 'SIG_DFL')
posix.kill(pid, posix.SIGTERM)
lpc.wait(pid)
end
......@@ -366,7 +369,7 @@ if not call(
elseif mode == 'fallback' then
for i, sig in ipairs({'HUP', 'PIPE'}) do
signal.signal('SIG'..sig, function() end)
signal(posix['SIG'..sig], 'SIG_IGN')
end
require('lsleep').sleep(10)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment