@@ -21,7 +21,6 @@ class Stdio extends EventEmitter implements DuplexStreamInterface
21
21
private $ closed = false ;
22
22
private $ incompleteLine = '' ;
23
23
private $ originalTtyMode = null ;
24
- private $ usesExtReadlineHandler = false ;
25
24
26
25
public function __construct (LoopInterface $ loop , ReadableStreamInterface $ input = null , WritableStreamInterface $ output = null , Readline $ readline = null )
27
26
{
@@ -245,9 +244,8 @@ public function handleCloseOutput()
245
244
*/
246
245
private function restoreTtyMode ()
247
246
{
248
- if ($ this -> usesExtReadlineHandler ) {
247
+ if (function_exists ( ' readline_callback_handler_remove ' ) ) {
249
248
// remove dummy readline handler to turn to default input mode
250
- $ this ->usesExtReadlineHandler = false ;
251
249
readline_callback_handler_remove ();
252
250
} elseif ($ this ->originalTtyMode !== null && is_resource (STDIN ) && $ this ->isTty ()) {
253
251
// Reset stty so it behaves normally again
@@ -279,14 +277,11 @@ private function createStdin(LoopInterface $loop)
279
277
280
278
$ stream = new ReadableResourceStream (STDIN , $ loop );
281
279
282
- if (PHP_OS === ' Linux ' && function_exists ('readline_callback_handler_install ' )) {
280
+ if (function_exists ('readline_callback_handler_install ' )) {
283
281
// Prefer `ext-readline` to install dummy handler to turn on raw input mode.
284
- // This is known to work on Linux and known to cause issues with CR/LF
285
- // on Mac, so we only use this on Linux for now, see also issue #66.
286
- // We will nevery actually feed the readline handler and instead
282
+ // We will never actually feed the readline handler and instead
287
283
// handle all input in our `Readline` implementation.
288
284
readline_callback_handler_install ('' , function () { });
289
- $ this ->usesExtReadlineHandler = true ;
290
285
return $ stream ;
291
286
}
292
287
0 commit comments