-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] OS X Can't call cli_set_process_title php without superuser #21076
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
[Console] OS X Can't call cli_set_process_title php without superuser #21076
Conversation
@@ -227,7 +227,15 @@ public function run(InputInterface $input, OutputInterface $output) | |||
|
|||
if (null !== $this->processTitle) { | |||
if (function_exists('cli_set_process_title')) { | |||
cli_set_process_title($this->processTitle); | |||
$success = @cli_set_process_title($this->processTitle); | |||
if (!$success) { |
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.
What about if (@cli_set_process_title($this->processTitle)) {
instead?
$success = @cli_set_process_title($this->processTitle); | ||
if (!$success) { | ||
if ('Darwin' === PHP_OS) { | ||
$output->writeln('<comment>Running "cli_get_process_title" not as a superuser is not supported on OS X.</comment>'); |
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.
Running "cli_get_process_title()" as an unprivileged user [...]?
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.
Thanks a lot. It's way better :)
$output->writeln('<comment>Running "cli_get_process_title" not as a superuser is not supported on OS X.</comment>'); | ||
} else { | ||
$error = error_get_last(); | ||
trigger_error($error['message'], E_USER_WARNING); |
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.
Instead of E_USER_WARNING
this should be $error['type']
, shouldn't 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.
Sure. But php forbids to use a E_*
error type. Only E_USER_*
are allowed.
Here I know it'll always be a E_WARNING
as documented in the manual. So I just need to use E_USER_WARNING
@@ -328,6 +328,11 @@ public function testRunWithProcessTitle() | |||
$command->setProcessTitle('foo'); | |||
$this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); | |||
if (function_exists('cli_set_process_title')) { | |||
if (null === @cli_get_process_title()) { | |||
if ('Darwin' === PHP_OS) { |
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.
if (null === @cli_get_process_title() && 'Darwin' === PHP_OS)
👍 Status: Reviewed |
cli_set_process_title($this->processTitle); | ||
if (false === @cli_set_process_title($this->processTitle)) { | ||
if ('Darwin' === PHP_OS) { | ||
$output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on OS X.</comment>'); |
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.
OS X
-> MacOS
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.
fixed
Thank you @ogizanagi. |
…t superuser (ogizanagi) This PR was merged into the 2.7 branch. Discussion ---------- [Console] OS X Can't call cli_set_process_title php without superuser | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A The console component test suite is failing on OS X (10.12.2) as the `cli_set_process_title` function seems not to be allowed to be called without superuser. It seems to be an OS X limitation. At least, the test suite should pass and a warning should be shown when using the component with this feature on OS X. --- refs: - http://stackoverflow.com/questions/27803120/cannot-set-process-title-in-a-php-command-line-script-using-cli-set-process-titl - liip/php-osx#139 - zfcampus/zf-console#22 Commits ------- 9928c0d [Console] OS X Can't call cli_set_process_title php without superuser
The console component test suite is failing on OS X (10.12.2) as the
cli_set_process_title
function seems not to be allowed to be called without superuser. It seems to be an OS X limitation.At least, the test suite should pass and a warning should be shown when using the component with this feature on OS X.
refs: