From e1f813ab601cd2ce464eb645b40760bf4bd2423a Mon Sep 17 00:00:00 2001 From: Netkas Date: Fri, 29 Sep 2023 17:01:59 -0400 Subject: [PATCH] Oops --- src/ncc/CLI/Commands/PackageInspectorCommand.php | 10 +++++++++- src/ncc/Classes/PackageReader.php | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ncc/CLI/Commands/PackageInspectorCommand.php b/src/ncc/CLI/Commands/PackageInspectorCommand.php index c98c8c3..cecd13b 100644 --- a/src/ncc/CLI/Commands/PackageInspectorCommand.php +++ b/src/ncc/CLI/Commands/PackageInspectorCommand.php @@ -285,8 +285,16 @@ */ private static function copyPackage(array $args): int { + $copy_path = $args['o']; + + if($copy_path === null) + { + Console::outError('Missing required option "-o"', true, 1); + return 1; + } + $package_reader = new PackageReader($args['path'] ?? $args['p']); - $package_reader->saveCopy($args['copy'] ?? $args['o']); + $package_reader->saveCopy($copy_path); return 0; } diff --git a/src/ncc/Classes/PackageReader.php b/src/ncc/Classes/PackageReader.php index 587023f..85db16d 100644 --- a/src/ncc/Classes/PackageReader.php +++ b/src/ncc/Classes/PackageReader.php @@ -668,7 +668,10 @@ } // Copy the package file to the destination - stream_copy_to_stream($this->package_file, $destination, $this->package_length, $this->package_offset); + if(stream_copy_to_stream($this->package_file, $destination, $this->package_length, $this->package_offset) === false) + { + throw new IOException(sprintf('Failed to copy package file to \'%s\'', $path)); + } // Done! fclose($destination);