瀏覽代碼

[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 年之前
父節點
當前提交
ac1d8bf3dd
共有 3 個文件被更改,包括 3 次插入5 次删除
  1. 1 1
      src/compiler/haxe.ml
  2. 1 1
      std/cpp/NativeProcess.hx
  3. 1 3
      std/cpp/_std/sys/io/Process.hx

+ 1 - 1
src/compiler/haxe.ml

@@ -243,7 +243,7 @@ module Initialize = struct
 				add_std "php";
 				add_std "php";
 				"php"
 				"php"
 			| Cpp ->
 			| Cpp ->
-				Common.define_value com Define.HxcppApiLevel "400";
+				Common.define_value com Define.HxcppApiLevel "430";
 				add_std "cpp";
 				add_std "cpp";
 				if Common.defined com Define.Cppia then
 				if Common.defined com Define.Cppia then
 					classes := (Path.parse_path "cpp.cppia.HostClasses" ) :: !classes;
 					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;
 	static function process_stdin_close(handle:Dynamic):Void;
 
 
 	@:native("_hx_std_process_exit")
 	@: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")
 	@:native("_hx_std_process_pid")
 	static function process_pid(handle:Dynamic):Int;
 	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> {
 	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 {
 	public function close():Void {