Support history in phutil_console_prompt()
Summary:
I've tried several approaches, this is the only one which works for me:
- There's almost no chance that readline() will be available in PHP so I don't even check it.
- I wasn't able to convince execx() to read the input.
- I wasn't able to convince phutil_passthru() to give me the $REPLY or output.
- Good old shell_exec() works.
I'm not sure if read -p supports colors but they are not much useful here.
I need to use read -p instead of echo otherwise the prompt is cleared with scrolling.
Test Plan:
phutil_console_prompt('Write:', '/tmp/history-test');
- Run several times.
- Input different strings.
- Scroll in history.
- Provide empty input.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2579