Przeglądaj źródła

[cpp] Non-blocking process exit code reading (#10321)

* Don't throw if a non-blocking exit code is requested

* Bump the hxcpp api level to 430
Aidan Lee 3 lat temu
rodzic
commit
ac1d8bf3dd

+ 1 - 1
src/compiler/haxe.ml

@@ -243,7 +243,7 @@ module Initialize = struct
 				add_std "php";
 				"php"
 			| Cpp ->
-				Common.define_value com Define.HxcppApiLevel "400";
+				Common.define_value com Define.HxcppApiLevel "430";
 				add_std "cpp";
 				if Common.defined com Define.Cppia then
 					classes := (Path.parse_path "cpp.cppia.HostClasses" ) :: !classes;

+ 1 - 1
std/cpp/NativeProcess.hx

@@ -43,7 +43,7 @@ extern class NativeProcess {
 	static function process_stdin_close(handle:Dynamic):Void;
 
 	@:native("_hx_std_process_exit")
-	static function process_exit(handle:Dynamic):Int;
+	static function process_exit(handle:Dynamic, block:Bool):Dynamic;
 
 	@:native("_hx_std_process_pid")
 	static function process_pid(handle:Dynamic):Int;

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

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