Skip to content

Commit

Permalink
Правка вызова shell_exec
Browse files Browse the repository at this point in the history
  • Loading branch information
boffart committed Oct 7, 2024
1 parent 9c1a4be commit 8eba191
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Core/System/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public static function getDevPartName(string $dev, string $part, bool $verbose =
$sortPath = Util::which('sort');

$basenameDisk = basename($dev);
$pathToDisk = trim(shell_exec("$lsBlkPath -n -p -a -r -o NAME,TYPE | $grepPath disk | $grepPath '$basenameDisk' | $cutPath -d ' ' -f 1"));
$pathToDisk = trim(shell_exec("$lsBlkPath -n -p -a -r -o NAME,TYPE | $grepPath disk | $grepPath '$basenameDisk' | $cutPath -d ' ' -f 1")??'');
if ($verbose) {
echo "Get dev full path..." . PHP_EOL;
echo "Source dev: $dev, result full path: $pathToDisk" . PHP_EOL;
Expand All @@ -528,9 +528,9 @@ public static function getDevPartName(string $dev, string $part, bool $verbose =

// Touch the disk to update disk tables
$command = "$lsBlkPath -r -p | $grepPath ' part' | $sortPath -u | $cutPath -d ' ' -f 1 | $grepPath '" . $pathToDisk . "' | $grepPath \"$part\$\"";
$devName = trim(shell_exec($command));
$devName = trim(shell_exec($command??'')??'');
if (empty($devName) && $verbose) {
$verboseMsg = trim(shell_exec("$lsBlkPath -r -p"));
$verboseMsg = trim(shell_exec("$lsBlkPath -r -p")??'');
echo "--- filtered command ---" . PHP_EOL;
echo $command . PHP_EOL;
echo "--- result 'lsblk -r -p' ---" . PHP_EOL;
Expand Down

0 comments on commit 8eba191

Please sign in to comment.