/** * Kills commands, which syntax is similar to this command */ public function killSimilar() { if (OS::WIN === OS::getCurrentOs()) { throw new OsNotSupportedExeception(); } $command = Command::create()->app('ps')->arg('aux')->app('grep')->input('"' . $this->prepareForProcessLog($this->command->getRaw()) . '"')->xargsApp()->input('awk', 'kill')->app1()->input('print $2')->exec(); }
/** * Checks if the set os is similar to the os of the executing machinge * * @throws OsNoMatchException */ private function checkOs() { if ($this->os !== OS::ALL && $this->os !== OS::getCurrentOs()) { throw new OsNoMatchException(); } }