In mysql.php ignore SIGINT
authorTim Starling <tstarling@wikimedia.org>
Wed, 18 Jul 2018 05:47:23 +0000 (15:47 +1000)
committerTim Starling <tstarling@wikimedia.org>
Wed, 18 Jul 2018 05:57:15 +0000 (15:57 +1000)
commit9dcd605d13188b43edbed8760bdf7984ac1c1a00
tree841b9992ae0c8f4134714e7bcfa945f617df0acf
parente5d71f2552893f15da9c0be7dd1fa210adb7be23
In mysql.php ignore SIGINT

Every foreground process with the terminal open will receive SIGINT when
the interrupt key is pressed. But mysql handles SIGINT and kills the
running query, we don't want the wrapper to exit in that case. So,
ignore SIGINT while mysql is running. This is similar to how a shell
deals with this problem.

The other options would have been:

* Close the filehandles in PHP after forking (probably impossible)
* Use pcntl_exec() so that PHP isn't running (more complicated and
  requires the pcntl extension anyway)
* Clear termcap ISIG flag (probably would have broken mysql)

Bug: T199152
Change-Id: I7660cd24e036fbe3fe36d12563ffe1c1fa2360d0
maintenance/mysql.php