Go to file
Brad Jorsch 7f94d88733 LuaStandalone: Fix signal handling
I252ec046 noticeably broke things by adding a dependency on the pcntl
functions, which tend not to be present under Apache.

It also subtly broke exit handling by using proc_close()'s return value,
which PHP mangles in such a way that we can't tell the difference
between an actual XCPU kill and exit( SIGXCPU ). This one wasn't noticed
because the pcntl functions interpret everything proc_close() is going
to return as a signal kill and we didn't test the 'exited' code path.

I'm not sure what was going on in I57cdf8aa since it provides no details
about what it was trying to fix, but that would have broken signal
handling in the other way: Ibf5f4656 worked because proc_open() on Linux
executes the command by passing it to /bin/sh -c, and that shell is
going to turn any signal that kills Lua (e.g. the SIGXCPU) into an exit
status of 128+signum.

To avoid proc_close()'s broken return value while also avoiding the
race, we can loop on proc_get_status() until $status['running'] is
false.

To have signals that kill Lua actually be interpreted as signals, we
have two options: add an "exec" in front of the command so proc_open()'s
/bin/sh -c is execed away, or detect shell-style signal reporting and
convert it. We may as well do both.

Bug: T128048
Change-Id: I8a62e1660fe1694e9ba5de77d01960c1ab4580aa
2017-03-09 23:16:28 +00:00
common Update for API error i18n 2016-11-14 12:48:25 -05:00
engines LuaStandalone: Fix signal handling 2017-03-09 23:16:28 +00:00
i18n Localisation updates from https://translatewiki.net. 2017-03-01 22:39:51 +01:00
modules Update jscs configuration 2016-02-13 16:18:05 +01:00
tests/engines LuaStandalone: Fix signal handling 2017-03-09 23:16:28 +00:00
.gitignore Expand .gitignore for more editors 2016-11-13 13:22:31 +01:00
.gitreview Whoops, track not trace 2016-10-24 17:03:31 -07:00
.jscsrc Update jscs configuration 2016-02-13 16:18:05 +01:00
.jshintignore Add jshint to npm 2016-02-19 15:33:18 +00:00
.jshintrc Changing jshint configuation 2016-12-14 23:29:41 +00:00
composer.json Specify license and add COPYING file 2016-09-16 01:38:15 +00:00
COPYING Specify license and add COPYING file 2016-09-16 01:38:15 +00:00
Gruntfile.js Add jshint to npm 2016-02-19 15:33:18 +00:00
package.json Add jshint to npm 2016-02-19 15:33:18 +00:00
phpcs.xml Fix uncontroversial phpcs errors 2016-05-18 16:31:28 -04:00
Scribunto.magic.php Add Russian magic word as backwards compatibility for Ukrainian 2016-11-24 14:54:09 +02:00
Scribunto.namespaces.php Localize namespaces in Kurdish 2017-02-01 19:15:49 +00:00
Scribunto.php Remove entry from ExtensionMessagesFiles 2017-01-12 21:47:57 +01:00