Skip to content

Commit

Permalink
Remove errout from sh.php output
Browse files Browse the repository at this point in the history
otherwise breaks json encoded output
  • Loading branch information
sonertari committed Feb 25, 2024
1 parent 6c9b860 commit 22812fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Controller/sh.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
$cwd= dirname(__FILE__);

// Run the ctlr using doas and passing -n for no arg validation, as we have already done that above
exec("/usr/bin/doas $cwd/ctlr.php -n ".escapeshellarg($args)." 2>&1", $encoded, $retval);
// Remove errout (redirect to /dev/null), otherwise breaks json encoded output
exec("/usr/bin/doas $cwd/ctlr.php -n ".escapeshellarg($args)." 2>/dev/null", $encoded, $retval);
// There must be only one element in $encoded array, but do not miss the others if any
$encoded= implode(' ', $encoded);
echo $encoded;
Expand Down

0 comments on commit 22812fc

Please sign in to comment.