mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-28 18:20:06 +00:00
7f94d88733
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 |
||
---|---|---|
.. | ||
LuaStandaloneInterpreterTest.php | ||
StandaloneTest.php | ||
StandaloneTests.lua |