Page MenuHomePhabricator

maintenance/sql.php should use Maintenance::readConsole to provide readline editing
Closed, ResolvedPublic

Description

sql.php seems to be optimized for running pre-prepared scripts, which is all well and good but it would be nice to get the GNU readline goodies when stdin is actually a terminal.

The readline stuff is encapsulated in Maintenance::readConsole() which'll return a line at a time.

Looks like sql.php sends stdin straight into Database::sourceStream() which does fgets() directly... that'll probably need to be extended to add a callback to override the actual reading, or else clever use of stream wrappers. :)


Version: 1.18.x
Severity: enhancement

Details

Reference
bz27207

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:16 PM
bzimport set Reference to bz27207.
bzimport added a subscriber: Unknown Object (MLST).

It looks like this issue has been fixed or maybe I am not understand it. From sql.php :

while ( ( $line = Maintenance::readconsole() ) !== false ) {

commit ebf916f3fb528bba0fcb5626701815a1810463de