Skip to content

Commit ed8436d

Browse files
committed
Cleanup coreutils detection
1 parent c526ac3 commit ed8436d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/AsyncTask.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,11 @@ public function start(): void
119119
// do we really have timeout here?
120120
if (static::$hasGnuCoreUtils === null) {
121121
// haven't checked before; check
122-
$tmpOut = [];
123-
if (!exec("command -v timeout || command -v gtimeout", $tmpOut)) {
124-
// can't even check this
125-
throw new RuntimeException("AsyncTask failed to check whether GNU coreutils is installed");
126-
}
127-
// extract details
128-
$cmdName = $tmpOut[0] ?? null;
129-
static::$hasGnuCoreUtils = $cmdName ? true : false;
122+
$tmpOut = exec("command -v timeout || command -v gtimeout");
123+
$cmdName = !empty($tmpOut) ? $tmpOut : null;
124+
unset($tmpOut);
125+
static::$hasGnuCoreUtils = $cmdName !== null;
130126
static::$timeoutCmdName = $cmdName;
131-
unset($cmdName);
132127
}
133128
if (static::$hasGnuCoreUtils === false) {
134129
// can't do anything without GNU coreutils!

0 commit comments

Comments
 (0)