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

Sign up
Appearance settings

Commit 96f4a19

Browse files
committed
命令判断是否需要sudo
1 parent ec839fa commit 96f4a19

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/InstallCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ public function buildOpenCV($directory)
251251
'cd opencv/build',
252252
$cmakeCommand,
253253
'make',
254-
'sudo make install',
255-
'sudo sh -c \'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf\'',
256-
'sudo ldconfig'
254+
$this->isRoot ? '' : 'sudo ' . 'make install',
255+
$this->isRoot ? '' : 'sudo ' . 'sh -c \'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf\'',
256+
$this->isRoot ? '' : 'sudo ' . 'ldconfig'
257257
];
258258
$process = new Process(implode(' && ', $commands), $directory, null, null, null);
259259
$process->setTty(Process::isTtySupported());//检查TTY支持
@@ -295,7 +295,7 @@ protected function buildPHPOpenCV($directory, $phpizePath, $phpConfigPath)
295295
'./configure --with-php-config=' . $phpConfigPath,//todo
296296
'make clean',
297297
'make',
298-
'sudo make install'
298+
$this->isRoot ? '' : 'sudo ' . 'make install'
299299
];
300300
$process = new Process(implode(' && ', $commands), $directory, null, null, null);
301301
$process->setTty(Process::isTtySupported());//检查TTY支持

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /