['pipe','w'],2=>['pipe','w']],$ps);$o=stream_get_contents($ps[1]);$e=stream_get_contents($ps[2]);foreach($ps as $s)fclose($s);return [proc_close($p),$o,$e];} function checked($a){[$c,$o,$e]=cmd($a);if($c)throw new Exception('Command failed, exit '.$c);return $o;} function protectedFile($p,$s){file_put_contents($p,$s);chmod($p,0600);}