1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-23 14:00:55 +01:00

Automatically answer excuse prompts if stdin is not a TTY

Summary: Fixes T3696. Currently, we abort. If stdin is not a TTY, we should just continue. A script which cares could conceivably run `arc lint` and `arc unit` separately, but it seems unlikely that any script would ever want to fail here.

Test Plan: Ran `echo -n '' | arc diff --create --verbatim` with a lint error and got a revision (D6720).

Reviewers: Firehed, btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3696

Differential Revision: https://secure.phabricator.com/D6721
This commit is contained in:
epriestley 2013-08-26 05:41:32 -07:00
parent 0f30aca626
commit 65c19ff0c0

View file

@ -1397,6 +1397,16 @@ EOTEXT
public function handleServerMessage(PhutilConsoleMessage $message) { public function handleServerMessage(PhutilConsoleMessage $message) {
$data = $message->getData(); $data = $message->getData();
if ($this->getArgument('excuse')) {
try {
phutil_console_require_tty();
} catch (PhutilConsoleStdinNotInteractiveException $ex) {
$this->excuses[$data['type']] = $this->getArgument('excuse');
return null;
}
}
$response = ''; $response = '';
if (isset($data['prompt'])) { if (isset($data['prompt'])) {
$response = phutil_console_prompt($data['prompt'], idx($data, 'history')); $response = phutil_console_prompt($data['prompt'], idx($data, 'history'));