limits = $limits; $this->cgroup = $cgroup; if ( $restrictionMethod === 'autodetect' ) { // On Linux systems check for firejail if ( PHP_OS === 'Linux' && $this->findFirejail() !== false ) { $this->restrictionMethod = 'firejail'; } else { $this->restrictionMethod = false; } } else { $this->restrictionMethod = $restrictionMethod; } $this->setLogger( new NullLogger() ); } private function findFirejail() { if ( $this->firejail === null ) { $this->firejail = ExecutableFinder::findInDefaultPaths( 'firejail' ); } return $this->firejail; } /** * When enabled, text sent to stderr will be logged with a level of 'error'. * * @param bool $yesno * @see Command::logStderr */ public function logStderr( $yesno = true ) { $this->doLogStderr = $yesno; } /** * Instantiates a new Command * * @return Command */ public function create() { if ( $this->restrictionMethod === 'firejail' ) { $command = new FirejailCommand( $this->findFirejail() ); $command->restrict( Shell::RESTRICT_DEFAULT ); } else { $command = new Command(); } $command->setLogger( $this->logger ); return $command ->limits( $this->limits ) ->cgroup( $this->cgroup ) ->logStderr( $this->doLogStderr ); } }