mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -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|null $input
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
function runProcess(string $cmd, ?string $input = null): void
|
||||
function runProcess(string $cmd, ?string $input = null): int
|
||||
{
|
||||
$descriptorSpec = [
|
||||
0 => ['pipe', 'r'],
|
||||
|
@ -100,7 +100,7 @@ function runProcess(string $cmd, ?string $input = null): void
|
|||
|
||||
if (!is_resource($process)) {
|
||||
out('- Could not start subprocess', 'error');
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Write input if provided
|
||||
|
@ -124,7 +124,7 @@ function runProcess(string $cmd, ?string $input = null): void
|
|||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
proc_close($process);
|
||||
return proc_close($process);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue