-
-
Notifications
You must be signed in to change notification settings - Fork 47
Throw LogicException on Windows #47
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
Throw LogicException on Windows #47
Conversation
README.md
Outdated
does work on [`Windows Subsystem for Linux`](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) | ||
Due to the blocking nature of `STDIN`/`STDOUT`/`STDERR` pipes on Windows we can | ||
not guarantee this package works as expected on Windows directly. As such when | ||
instantiating `Process` it throws an exception when on Windows directly. |
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.
The doubling of "directly" at the end of the 2 sentences could probably be avoided.
src/Process.php
Outdated
* @throws RuntimeException When proc_open() is not installed | ||
*/ | ||
public function __construct($cmd, $cwd = null, array $env = null, array $options = array()) | ||
{ | ||
if (substr(strtolower(PHP_OS), 0, 3) === 'win') { | ||
throw new \LogicException('Windows isn\'t supported.'); |
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.
The exception message could be a little bit more descriptiove, something like "Windows isn't supported due to the blocking nature of STDIN/STDOUT/STDERR pipes."
d511846
to
3df3f54
Compare
@jsor updated the PR with your suggestions 👍 |
* @throws RuntimeException When proc_open() is not installed | ||
*/ | ||
public function __construct($cmd, $cwd = null, array $env = null, array $options = array()) | ||
{ | ||
if (substr(strtolower(PHP_OS), 0, 3) === 'win') { | ||
throw new \LogicException('Windows isn\'t supported due to the blocking nature of STDIN/STDOUT/STDERR pipes.'); |
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.
Requiring not windows
is same kind of precondition as requiring proc_open
function to exists so both exceptions should be same type.
IMHO both should be LogicException.
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.
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.
No strong opinion here, but makes sense 👍
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.
@mdrost care to open a PR for it?
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.
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.
@mdrost Yup saw it 👍
Since pipes Windows always block this PR introduces always throwing an exception so we don't allocate unnecessary resources.
Follows up #41