mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
update runProcess to return process exit code
This commit is contained in:
parent
e5ebf855ba
commit
c3182ae740
1 changed files with 4 additions and 4 deletions
|
@ -86,9 +86,9 @@ function out(string $str, string $type = ''): void
|
||||||
*
|
*
|
||||||
* @param string $cmd
|
* @param string $cmd
|
||||||
* @param string|null $input
|
* @param string|null $input
|
||||||
* @return void
|
* @return int
|
||||||
*/
|
*/
|
||||||
function runProcess(string $cmd, ?string $input = null): void
|
function runProcess(string $cmd, ?string $input = null): int
|
||||||
{
|
{
|
||||||
$descriptorSpec = [
|
$descriptorSpec = [
|
||||||
0 => ['pipe', 'r'],
|
0 => ['pipe', 'r'],
|
||||||
|
@ -100,7 +100,7 @@ function runProcess(string $cmd, ?string $input = null): void
|
||||||
|
|
||||||
if (!is_resource($process)) {
|
if (!is_resource($process)) {
|
||||||
out('- Could not start subprocess', 'error');
|
out('- Could not start subprocess', 'error');
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write input if provided
|
// Write input if provided
|
||||||
|
@ -124,7 +124,7 @@ function runProcess(string $cmd, ?string $input = null): void
|
||||||
fclose($pipes[1]);
|
fclose($pipes[1]);
|
||||||
fclose($pipes[2]);
|
fclose($pipes[2]);
|
||||||
|
|
||||||
proc_close($process);
|
return proc_close($process);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue