Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MatterbridgeManager: Silence exec()/shell_exec()
Signed-off-by: Daniel Rudolf <[email protected]>
  • Loading branch information
PhrozenByte committed Dec 10, 2020
commit c9577a6328137cf64714d4e4340c3eb8d3f111cd
4 changes: 2 additions & 2 deletions lib/MatterbridgeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ private function launchMatterbridge(Room $room): int {
*/
public function killZombieBridges(bool $killAll = false): void {
// get list of running matterbridge processes
$cmd = 'ps x -o user,pid,args | grep "matterbridge" | grep -v grep | awk \'{print $2}\'';
$cmd = 'ps x -o user,pid,args 2>/dev/null | grep "matterbridge" | grep -v grep | awk \'{print $2}\'';
exec($cmd, $output, $ret);
$runningPidList = [];
foreach ($output as $o) {
Expand Down Expand Up @@ -758,7 +758,7 @@ private function killPid(int $pid): bool {
*/
private function isRunning(int $pid): bool {
try {
$result = shell_exec(sprintf('ps x -o user,pid,args | awk \'{print $2}\' | grep "^%d$" | wc -l', $pid));
$result = shell_exec(sprintf('ps x -o user,pid,args 2>/dev/null | awk \'{print $2}\' | grep "^%d$" | wc -l', $pid));
if ((int) $result > 0) {
return true;
}
Expand Down