File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/Symfony/Component/Process/Pipes Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -51,17 +51,22 @@ public function __construct($disableOutput, $input)
51
51
Process::STDOUT => Process::OUT ,
52
52
Process::STDERR => Process::ERR ,
53
53
);
54
+ $ tmpCheck = false ;
54
55
$ tmpDir = sys_get_temp_dir ();
55
- $ error = 'unknown reason ' ;
56
- set_error_handler (function ($ type , $ msg ) use (&$ error ) { $ error = $ msg ; });
56
+ $ lastError = 'unknown reason ' ;
57
+ set_error_handler (function ($ type , $ msg ) use (&$ lastError ) { $ lastError = $ msg ; });
57
58
for ($ i = 0 ;; ++$ i ) {
58
59
foreach ($ pipes as $ pipe => $ name ) {
59
60
$ file = sprintf ('%s \\sf_proc_%02X.%s ' , $ tmpDir , $ i , $ name );
60
61
if (file_exists ($ file ) && !unlink ($ file )) {
61
62
continue 2 ;
62
63
}
63
64
$ h = fopen ($ file , 'xb ' );
64
- if (!$ h && false === strpos ($ error , 'File exists &
6537
#39; )) {
65
+ if (!$ h ) {
66
+ $ error = $ lastError ;
67
+ if ($ tmpCheck || $ tmpCheck = unlink (tempnam (false , 'sf_check_ ' ))) {
68
+ continue ;
69
+ }
65
70
restore_error_handler ();
66
71
throw new RuntimeException (sprintf ('A temporary file could not be opened to write the process output: %s ' , $ error ));
67
72
}
You can’t perform that action at this time.
0 commit comments