Req #18703 [Opn->Csd]: No way to override reading of stdin with -
| From: | izi@php.net | Date: | Thu, 25 Oct 2012 08:14:12 +0000 |
| Subject: | Req #18703 [Opn->Csd]: No way to override reading of stdin with - | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9234@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=18703&edit=1
ID: 18703
Updated by: izi@php.net
Reported By: gwynne at php dot net
Summary: No way to override reading of stdin with -
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Console_CommandLine
Operating System: *
Package Version: 1.1.3
PHP Version: 5.3.6
-Assigned To:
+Assigned To: izi
Roadmap Versions:
New Comment:
-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.
Previous Comments:
------------------------------------------------------------------------
[2011-08-03 01:39:34] gwynne
Added #patch bug:18703;patch:no_stdin.patch;revision:1312331974;.
------------------------------------------------------------------------
[2011-08-03 01:39:02] gwynne
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>
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=18703&edit=1