Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Request #18703 No way to override reading of stdin with -
Submitted: 2011-08-03 05:39 UTC
From: gwynne Assigned: izi
Status: Closed Package: Console_CommandLine (version 1.1.3)
PHP Version: 5.3.6 OS: *
Roadmaps: (Not assigned)    
Subscription  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 28 + 6 = ?

 
 [2011-08-03 05:39 UTC] gwynne (Gwynne Raskind)
Description: ------------ There is no way to tell Console_CommandLine not to return "-" as an option or argument of its own; it will always try to read STDIN in its entirety. This is undesirable for applications which wish to read STDIN gradually, either because they expect large inputs (memory issues) or because they will use stream operations and see no reason to waste resources wrapping a stream around a string. It also makes testing more difficult when input must always be provided for applications which have operating modes in which the input might go unused. The patch to add this option is attached. Test script: --------------- <?php $parser = new Console_CommandLine; // some options here $parser->addArgument('input', array('description' => 'input file', 'multiple' => FALSE)); try { $result = $parser->parse(); } catch (Exception $e) { $parser->displayError($e->getMessage()); } print_r($result->args); ?> Expected result: ---------------- $ php myscript.php - Array ( [input] => - ) $ Actual result: -------------- $ php myscript.php - <blocks forever>

Comments

 [2011-08-03 05:39 UTC] gwynne (Gwynne Raskind)
 [2012-10-25 13:14 UTC] izi (David Jean Louis)
-Status: Open +Status: Closed -Assigned To: +Assigned To: izi
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.