Created
          March 3, 2015 06:34 
        
      - 
      
 - 
        
Save davidneimeyer/27c984252d2056c3bddc to your computer and use it in GitHub Desktop.  
    A non echoing prompt reader for CLImate
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| use League\CLImate\Util\Reader\Stdin; | |
| /** | |
| * StdinNoEcho | |
| * | |
| * This is a quick hack to implement https://github.com/thephpleague/climate/issues/31 | |
| * Informed by http://stackoverflow.com/a/2654048 | |
| */ | |
| class StdinNoEcho extends Stdin | |
| { | |
| public function line() | |
| { | |
| exec('stty -g', $output); // save original terminal setting | |
| exec('stty -echo'); // turn-off echoing. | |
| $response = parent::line(); | |
| exec('stty ' . implode("\n", $output)); // restore | |
| return $response; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Great stuff, good workaround.
For an ultimate solution (included in the core package) windows support (unfortunately) should also be solved somehow.