From a7a2d16511f6f932007f54e187d84572b87c8909 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 9 Aug 2016 16:15:57 +0200 Subject: [PATCH] [Process] Strengthen Windows pipe files opening (again...) --- src/Symfony/Component/Process/Pipes/WindowsPipes.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index db66c672a7dae..7b2e5b4b23c3d 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -51,9 +51,10 @@ public function __construct($disableOutput, $input) Process::STDOUT => Process::OUT, Process::STDERR => Process::ERR, ); + $tmpCheck = false; $tmpDir = sys_get_temp_dir(); - $error = 'unknown reason'; - set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); + $lastError = 'unknown reason'; + set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); for ($i = 0;; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); @@ -61,7 +62,11 @@ public function __construct($disableOutput, $input) continue 2; } $h = fopen($file, 'xb'); - if (!$h && false === strpos($error, 'File exists')) { + if (!$h) { + $error = $lastError; + if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) { + continue; + } restore_error_handler(); throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error)); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy