shell.php is an interactive shell based on PsySH (intended to be the successor of eval.php, which is used for testing/debugging). To get around the problem of fatal errors causing the PHP process to exit, it uses a forked subprocess and stream_select to run commands. Apparently when the subprocess is created it immediately receives some kind of signal which confuses stream_select.
tgr@mw1279:~$ sudo -u www-data php /srv/mediawiki/multiversion/MWScript.php shell.php enwiki [Fri Feb 9 23:36:25 2018] [hphp] [31577:7f7e46ae1200:0:000001]  Notice: Writing to /home/tgr/.config/psysh is not allowed. in /srv/mediawiki/php-1.31.0-wmf.20/vendor/psy/psysh/src/Psy/ConfigPaths.php on line 213 Psy Shell v0.8.11 (PHP 5.6.99-hhvm — cli) by Justin Hileman >>> 1 => 1 [Fri Feb 9 23:36:41 2018] [hphp] [31577:7f7e46ae1200:0:000002]  Warning: unable to select : Interrupted system call in /srv/mediawiki/php-1.31.0-wmf.20/vendor/psy/psysh/src/Psy/ExecutionLoop/ForkingLoop.php on line 57 RuntimeException with message 'Error waiting for execution loop.' >>> tgr@mw1279:~$
shell.php is a lot more powerful than eval.php, it would be nice to get it working everywhere.
(Also PsySH tries to store the history in ~/.config/psysh but can't since it's running as www-data, but that's a much more minor annoyance.)
Workaround: PHP="hhvm -d hhvm.server.light_process_count=0" mwscript shell.php enwiki