Skip to content
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

Merged
merged 3 commits into from
Dec 1, 2017

Conversation

martinqvistgard
Copy link

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!

@mikehaertl
Copy link
Owner

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)) {
Copy link
Owner

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?

Copy link
Author

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)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, see above.

@mikehaertl mikehaertl merged commit a0c445a into mikehaertl:master Dec 1, 2017
@mikehaertl
Copy link
Owner

Released 1.3.0 including this change. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants