From 2dcddfb76143a94aa3bacadcd3f5a2d56247546f Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Wed, 6 Mar 2019 19:18:35 +0100 Subject: [PATCH] Use deterministic path for exe copy outside phar Fixes #37. --- lib/Internal/Windows/Runner.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Internal/Windows/Runner.php b/lib/Internal/Windows/Runner.php index 31bda03..7684b63 100644 --- a/lib/Internal/Windows/Runner.php +++ b/lib/Internal/Windows/Runner.php @@ -41,7 +41,7 @@ final class Runner implements ProcessRunner // We can't execute the exe from within the PHAR, so copy it out... if (\strncmp($wrapperPath, "phar://", 7) === 0) { if (self::$pharWrapperPath === null) { - self::$pharWrapperPath = \tempnam(\sys_get_temp_dir(), "amphp-process-wrapper-"); + self::$pharWrapperPath = \sys_get_temp_dir() . "amphp-process-wrapper-" . \hash('sha1', \file_get_contents(self::WRAPPER_EXE_PATH)); \copy(self::WRAPPER_EXE_PATH, self::$pharWrapperPath); \register_shutdown_function(static function () {