Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15407768
D21317.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21317.id.diff
View Options
diff --git a/src/toolset/ArcanistPrompt.php b/src/toolset/ArcanistPrompt.php
--- a/src/toolset/ArcanistPrompt.php
+++ b/src/toolset/ArcanistPrompt.php
@@ -113,12 +113,32 @@
$write = array();
$except = array();
- $ok = stream_select($read, $write, $except, 1);
+ $ok = @stream_select($read, $write, $except, 1);
if ($ok === false) {
- throw new Exception(pht('stream_select() failed!'));
+ // NOTE: We may be interrupted by a system call, particularly if
+ // the window is resized while a prompt is shown and the terminal
+ // sends SIGWINCH.
+
+ // If we are, just continue below and try to read from stdin. If
+ // we were interrupted, we should read nothing and continue
+ // normally. If the pipe is broken, the read should fail.
+ }
+
+ $response = '';
+ while (true) {
+ $bytes = fread($stdin, 8192);
+ if ($bytes === false) {
+ throw new Exception(
+ pht('fread() from stdin failed with an error.'));
+ }
+
+ if (!strlen($bytes)) {
+ break;
+ }
+
+ $response .= $bytes;
}
- $response = fgets($stdin);
if (!strlen($response)) {
continue;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 7:27 PM (3 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706300
Default Alt Text
D21317.id.diff (1 KB)
Attached To
Mode
D21317: When "arc" receives SIGWINCH or other signals during display of a prompt, recover
Attached
Detach File
Event Timeline
Log In to Comment