Browse Source

Try to avoid unlink(): Resource temporarily unavailable error

Andy Li 6 years ago
parent
commit
80c1ca9a24
2 changed files with 10 additions and 0 deletions
  1. 5 0
      std/php/Global.hx
  2. 5 0
      tests/sys/src/TestCommandBase.hx

+ 5 - 0
std/php/Global.hx

@@ -1374,4 +1374,9 @@ extern class Global {
 		@see http://php.net/manual/en/function.is-uploaded-file.php
 	**/
 	static function is_uploaded_file( filename:String ) : Bool;
+
+	/**
+		@see http://php.net/manual/en/function.gc-collect-cycles.php
+	**/
+	static function gc_collect_cycles() : Int;
 }

+ 5 - 0
tests/sys/src/TestCommandBase.hx

@@ -80,6 +80,11 @@ class TestCommandBase extends utest.Test {
 				if (exitCode != random)
 					trace(name);
 				Assert.equals(random, exitCode);
+
+				// Try to avoid unlink(): Resource temporarily unavailable error
+				#if php
+				php.Global.gc_collect_cycles();
+				#end
 				FileSystem.deleteFile(path);
 			}
 		}