diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-09-29 16:44:53 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-09-29 16:44:53 +0300 |
commit | 6369a766b36f3ad07330c4657f699ca2666051c1 (patch) | |
tree | c7792ac21ffc5f5b82de850ecf2529f5412af4c4 | |
parent | 3e98b6347234d2d2fc48d3da866f75960503974a (diff) | |
download | awall-6369a766b36f3ad07330c4657f699ca2666051c1.tar.bz2 awall-6369a766b36f3ad07330c4657f699ca2666051c1.tar.xz |
use lua-posix rather than lua-signal
-rwxr-xr-x | awall-cli | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -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) |