Skip to content

Commit 4c84374

Browse files
committed
Restore STDIN to default blocking mode before closing
1 parent 0d6f7e5 commit 4c84374

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Stdin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ private function restore()
5656
shell_exec(sprintf('stty %s', $this->oldMode));
5757
$this->oldMode = null;
5858
}
59+
60+
// restore blocking mode so following programs behave normally
61+
if (defined('STDIN') && is_resource(STDIN)) {
62+
stream_set_blocking(STDIN, true);
63+
}
5964
}
6065

6166
/**

0 commit comments

Comments
 (0)