瀏覽代碼

Set default value of Process.exitCode as true for backward compatibility (#5902)

* Set default value of Process.exitCode as true for backward compatibility

* [php] properly quote bytes with zero byte for Mysql & SQLite (fixes #4489)

* [php7] non-blocking Process.exitCode(false)
Valentin Lemière 8 年之前
父節點
當前提交
3384a7cc26

+ 1 - 0
extra/CHANGES.txt

@@ -29,6 +29,7 @@
 	php : fixed checking floats for equality (#4260)
 	php : fixed checking floats for equality (#4260)
 	php : throw if invalid json string supplied to Json.parse() (#4592)
 	php : throw if invalid json string supplied to Json.parse() (#4592)
 	php : fixed ssl connections (#4581)
 	php : fixed ssl connections (#4581)
+	php : fixed writing bytes containing zero byte to MySQL & SQLite (#4489)
 	php : fixed call()() cases for PHP5 (#5569)
 	php : fixed call()() cases for PHP5 (#5569)
 
 
 2016-11-29: 3.4.0-RC1
 2016-11-29: 3.4.0-RC1

+ 1 - 1
std/cpp/_std/sys/io/Process.hx

@@ -104,7 +104,7 @@ class Process {
 		return NativeProcess.process_pid(p);
 		return NativeProcess.process_pid(p);
 	}
 	}
 
 
-	public function exitCode( ?block : Bool ) : Null<Int> {	
+	public function exitCode( block : Bool = true ) : Null<Int> {
 		if( block == false ) throw "Non blocking exitCode() not supported on this platform";
 		if( block == false ) throw "Non blocking exitCode() not supported on this platform";
 		return NativeProcess.process_exit(p);
 		return NativeProcess.process_exit(p);
 	}
 	}

+ 1 - 1
std/cs/_std/sys/io/Process.hx

@@ -109,7 +109,7 @@ class Process {
 		return native.Id;
 		return native.Id;
 	}
 	}
 
 
-	public function exitCode( ?block : Bool ) : Null<Int>
+	public function exitCode( block : Bool = true ) : Null<Int>
 	{
 	{
 		if( block == false && !native.HasExited )
 		if( block == false && !native.HasExited )
 			return null;
 			return null;

+ 1 - 1
std/hl/_std/sys/io/Process.hx

@@ -157,7 +157,7 @@ private class Stdout extends haxe.io.Input {
 		return _pid(p);
 		return _pid(p);
 	}
 	}
 
 
-	public function exitCode( ?block : Bool ) : Null<Int> {
+	public function exitCode( block : Bool = true ) : Null<Int> {
 		var running = false;
 		var running = false;
 		var code = _exit(p, block == false ? new hl.Ref(running) : null);
 		var code = _exit(p, block == false ? new hl.Ref(running) : null);
 		if( block == false )
 		if( block == false )

+ 1 - 1
std/java/_std/sys/io/Process.hx

@@ -92,7 +92,7 @@ class Process {
 		return -1;
 		return -1;
 	}
 	}
 
 
-	public function exitCode( ?block : Bool ) : Null<Int>
+	public function exitCode( block : Bool = true ) : Null<Int>
 	{
 	{
 		if( block == false ) {
 		if( block == false ) {
 			try {
 			try {

+ 1 - 1
std/lua/_std/sys/io/Process.hx

@@ -51,7 +51,7 @@ class Process {
 
 
 	public function close() : Void { }
 	public function close() : Void { }
 
 
-	public function exitCode( ?block : Bool ) : Null<Int> { return 0; }
+	public function exitCode( block : Bool = true ) : Null<Int> { return 0; }
 
 
 	public function kill() : Void { }
 	public function kill() : Void { }
 }
 }

+ 1 - 1
std/neko/_std/sys/io/Process.hx

@@ -106,7 +106,7 @@ private class Stdout extends haxe.io.Input {
 		return _pid(p);
 		return _pid(p);
 	}
 	}
 
 
-	public function exitCode( ?block : Bool ) : Null<Int> {
+	public function exitCode( block : Bool = true ) : Null<Int> {
 		if( block == false ) throw "Non blocking exitCode() not supported on this platform";
 		if( block == false ) throw "Non blocking exitCode() not supported on this platform";
 		return _exit(p);
 		return _exit(p);
 	}
 	}

+ 1 - 1
std/php/_std/sys/io/Process.hx

@@ -139,7 +139,7 @@ class Process {
 		untyped input.p = fp;
 		untyped input.p = fp;
 	}
 	}
 
 
-	public function exitCode( ?block : Bool ) : Null<Int> {
+	public function exitCode( block : Bool = true ) : Null<Int> {
 		if (null == cl)
 		if (null == cl)
 		{
 		{
 			st = untyped __call__('proc_get_status', p);
 			st = untyped __call__('proc_get_status', p);

+ 5 - 5
std/php7/_std/sys/io/Process.hx

@@ -157,11 +157,11 @@ class Process {
 		return pid;
 		return pid;
 	}
 	}
 
 
-	/**
-		Block until the process exits and return the exit code of the process.
-		If the process has already exited, return the exit code immediately.
-	*/
-	public function exitCode() : Int {
+	public function exitCode( block : Bool = true ) : Null<Int> {
+		if(!block) {
+			updateStatus();
+			return (running ? null : _exitCode);
+		}
 		while (running) {
 		while (running) {
 			var arr = Syntax.arrayDecl(process);
 			var arr = Syntax.arrayDecl(process);
 			Syntax.suppress(Global.stream_select(arr, arr, arr, null));
 			Syntax.suppress(Global.stream_select(arr, arr, arr, null));

+ 1 - 1
std/python/_std/sys/io/Process.hx

@@ -46,7 +46,7 @@ class Process {
 	public function getPid() : Int {
 	public function getPid() : Int {
 		return p.pid;
 		return p.pid;
 	}
 	}
-	public function exitCode( ?block : Bool ) : Null<Int> {
+	public function exitCode( block : Bool = true ) : Null<Int> {
 		if( block == false )
 		if( block == false )
 			return p.poll();
 			return p.poll();
 		return p.wait();
 		return p.wait();

+ 1 - 1
std/sys/io/Process.hx

@@ -63,7 +63,7 @@ extern class Process {
 		If `block` is false, it will return either the process exit code if it's already terminated or null if it's still running.
 		If `block` is false, it will return either the process exit code if it's already terminated or null if it's still running.
 		If the process has already exited, return the exit code immediately.
 		If the process has already exited, return the exit code immediately.
 	*/
 	*/
-	function exitCode( ?block : Bool ) : Null<Int>;
+	function exitCode( block : Bool = true ) : Null<Int>;
 
 
 	/**
 	/**
 		Close the process handle and release the associated resources.
 		Close the process handle and release the associated resources.