Skip to content

Commit

Permalink
Restore STDIN to default blocking mode before closing
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Nov 1, 2017
1 parent 0d6f7e5 commit 4c84374
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Stdin.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ private function restore()
shell_exec(sprintf('stty %s', $this->oldMode));
$this->oldMode = null;
}

// restore blocking mode so following programs behave normally
if (defined('STDIN') && is_resource(STDIN)) {
stream_set_blocking(STDIN, true);
}
}

/**
Expand Down

0 comments on commit 4c84374

Please sign in to comment.