Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9928c0d

Browse filesBrowse files
committed
[Console] OS X Can't call cli_set_process_title php without superuser
1 parent f1f5bff commit 9928c0d
Copy full SHA for 9928c0d

File tree

2 files changed

+11
-1
lines changed
Filter options

2 files changed

+11
-1
lines changed

‎src/Symfony/Component/Console/Command/Command.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Command/Command.php
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,14 @@ public function run(InputInterface $input, OutputInterface $output)
227227

228228
if (null !== $this->processTitle) {
229229
if (function_exists('cli_set_process_title')) {
230-
cli_set_process_title($this->processTitle);
230+
if (false === @cli_set_process_title($this->processTitle)) {
231+
if ('Darwin' === PHP_OS) {
232+
$output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
233+
} else {
234+
$error = error_get_last();
235+
trigger_error($error['message'], E_USER_WARNING);
236+
}
237+
}
231238
} elseif (function_exists('setproctitle')) {
232239
setproctitle($this->processTitle);
233240
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {

‎src/Symfony/Component/Console/Tests/Command/CommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Command/CommandTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ public function testRunWithProcessTitle()
328328
$command->setProcessTitle('foo');
329329
$this->assertSame(0, $command->run(new StringInput(''), new NullOutput()));
330330
if (function_exists('cli_set_process_title')) {
331+
if (null === @cli_get_process_title() && 'Darwin' === PHP_OS) {
332+
$this->markTestSkipped('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.');
333+
}
331334
$this->assertEquals('foo', cli_get_process_title());
332335
}
333336
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.