浏览代码

[python] extern for subprocess.run() (closes #10340)

Aleksandr Kuzmenko 4 年之前
父节点
当前提交
736b3a73b2
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      std/python/lib/Subprocess.hx

+ 9 - 0
std/python/lib/Subprocess.hx

@@ -30,6 +30,14 @@ extern class StartupInfo {
 	var wShowWindow:Int;
 }
 
+extern class CompletedProcess {
+	var args:EitherType<String, Array<String>>;
+	var returncode:Int;
+	var stdout:Null<EitherType<Bytes,String>>;
+	var stderr:Null<EitherType<Bytes,String>>;
+	function check_returncode():Void;
+}
+
 @:pythonImport("subprocess")
 extern class Subprocess {
 	static function STARTUPINFO():StartupInfo;
@@ -49,4 +57,5 @@ extern class Subprocess {
 	static var STDOUT:Int;
 
 	static function call(args:EitherType<String, Array<String>>, ?kwArgs:python.KwArgs<Dynamic>):Int;
+	static function run(args:EitherType<String, Array<String>>, ?kwArgs:python.KwArgs<Dynamic>):CompletedProcess;
 }