aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/shell_common.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 657f0df8f..197f41658 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -222,24 +222,6 @@ shell_builtin_read(struct builtin_read_params *params)
222 pfd->events = POLLIN; 222 pfd->events = POLLIN;
223 223
224#if ENABLE_PLATFORM_MINGW32 224#if ENABLE_PLATFORM_MINGW32
225 /* Don't poll if timeout is -1, it hurts performance. The
226 * caution above about interrupts isn't relevant on Windows
227 * where Ctrl-C causes an event, not a signal.
228 */
229 if (timeout >= 0)
230#endif
231 /* test bb_got_signal, then poll(), atomically wrt signals */
232 if (check_got_signal_and_poll(pfd, timeout) <= 0) {
233 /* timed out, or some error */
234 err = errno;
235 if (!err) { /* timed out */
236 retval = (const char *)(uintptr_t)2;
237 break;
238 }
239 retval = (const char *)(uintptr_t)1;
240 goto ret;
241 }
242#if ENABLE_PLATFORM_MINGW32
243 if (isatty(fd)) { 225 if (isatty(fd)) {
244 int64_t key; 226 int64_t key;
245 227
@@ -272,13 +254,32 @@ shell_builtin_read(struct builtin_read_params *params)
272 /* echo input if not in silent mode */ 254 /* echo input if not in silent mode */
273 console_write(buffer + bufpos, 1); 255 console_write(buffer + bufpos, 1);
274 } 256 }
275 } else 257 } else {
258 /* Don't poll if timeout is -1, it hurts performance. The
259 * caution above about interrupts isn't relevant on Windows
260 * where Ctrl-C causes an event, not a signal.
261 */
262 if (timeout >= 0)
276#endif 263#endif
264 /* test bb_got_signal, then poll(), atomically wrt signals */
265 if (check_got_signal_and_poll(pfd, timeout) <= 0) {
266 /* timed out, or some error */
267 err = errno;
268 if (!err) { /* timed out */
269 retval = (const char *)(uintptr_t)2;
270 break;
271 }
272 retval = (const char *)(uintptr_t)1;
273 goto ret;
274 }
277 if (read(fd, &buffer[bufpos], 1) != 1) { 275 if (read(fd, &buffer[bufpos], 1) != 1) {
278 err = errno; 276 err = errno;
279 retval = (const char *)(uintptr_t)1; 277 retval = (const char *)(uintptr_t)1;
280 break; 278 break;
281 } 279 }
280#if ENABLE_PLATFORM_MINGW32
281 }
282#endif
282 283
283 c = buffer[bufpos]; 284 c = buffer[bufpos];
284#if ENABLE_PLATFORM_MINGW32 285#if ENABLE_PLATFORM_MINGW32