-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable feeding a string from php to standard input #28
Conversation
This looks awesome, thanks! I only have a minor nitpick about coding style. If you could change that I'm happy to merge this. |
src/Command.php
Outdated
@@ -322,10 +337,18 @@ public function execute() | |||
1 => array('pipe','w'), | |||
2 => array('pipe', $this->getIsWindows() ? 'a' : 'w'), | |||
); | |||
if (isset($this->_stdIn)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually prefer !== null
instead of isset()
as I find it more clear. Could you maybe change that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad that you liked it!
I have changed this as requested.
src/Command.php
Outdated
$process = proc_open($command, $descriptors, $pipes, $this->procCwd, $this->procEnv, $this->procOptions); | ||
|
||
if (is_resource($process)) { | ||
|
||
if(isset($this->_stdIn)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, see above.
Released 1.3.0 including this change. Thanks again! |
These changes will make it possible to 'pipe' a string from php into the standard input stream of the command shell process.
Please consider this pr as I have found it quite useful.
Thank you for a very handy command wrapper!