|
@@ -1,6 +1,7 @@
|
|
|
|
|
|
package python.lib.subprocess;
|
|
|
|
|
|
+import python.lib.io.BufferedReader;
|
|
|
import python.lib.io.TextIOBase;
|
|
|
import python.lib.Subprocess.StartupInfo;
|
|
|
import python.lib.Types;
|
|
@@ -8,9 +9,9 @@ import python.lib.Types;
|
|
|
typedef PopenOptions = {
|
|
|
?bufsize : Int,
|
|
|
?executable : String,
|
|
|
- ?stdin : TextIOBase,
|
|
|
- ?stdout : TextIOBase,
|
|
|
- ?stderr : TextIOBase,
|
|
|
+ ?stdin : Dynamic,
|
|
|
+ ?stdout : Dynamic,
|
|
|
+ ?stderr : Dynamic,
|
|
|
?preexec_fn : Void->Void,
|
|
|
?close_fds : Bool,
|
|
|
?shell : Bool,
|
|
@@ -37,28 +38,41 @@ extern class Popen {
|
|
|
o.env = if (Reflect.hasField(o, "env")) o.env else null;
|
|
|
o.universal_newlines = if (Reflect.hasField(o, "universal_newlines")) o.universal_newlines else null;
|
|
|
o.startupinfo = if (Reflect.hasField(o, "startupinfo")) o.startupinfo else null;
|
|
|
+
|
|
|
o.creationflags = if (Reflect.hasField(o, "creationflags")) o.creationflags else 0;
|
|
|
|
|
|
- return new Popen(args, o.bufsize, o.executable, o.stdin, o.stdout, o.stderr, o.preexec_fn,
|
|
|
+ if (std.Sys.systemName() == "Windows") {
|
|
|
+ return new Popen(args, o.bufsize, o.executable, o.stdin, o.stdout, o.stderr, o.preexec_fn,
|
|
|
o.close_fds, o.shell, o.cwd, o.env, o.universal_newlines, o.startupinfo, o.creationflags);
|
|
|
+ } else {
|
|
|
+ return new Popen(args, o.bufsize, o.executable, o.stdin, o.stdout, o.stderr, o.preexec_fn,
|
|
|
+ o.close_fds, o.shell, o.cwd, o.env, o.universal_newlines, o.startupinfo);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- public function new (args:Array<String>, bufsize:Int=0, executable:String = null,
|
|
|
- stdin:FileObject = null, stdout:FileObject = null, stderr:FileObject=null, preexec_fn:Void->Void=null,
|
|
|
- close_fds:Bool=false, shell:Bool=false, cwd:String=null, env:Dict<String,String>=null,
|
|
|
+ public function new (args:Array<String>, bufsize:Int=0, executable:String = null,
|
|
|
+ stdin:Int = null, stdout:Int = null, stderr:Int=null, preexec_fn:Void->Void=null,
|
|
|
+ close_fds:Bool=false, shell:Bool=false, cwd:String=null, env:Dict<String,String>=null,
|
|
|
universal_newlines:Bool=false, startupinfo:StartupInfo=null, creationflags:Int=0):Void;
|
|
|
|
|
|
|
|
|
- public var stdin:TextIOBase;
|
|
|
+
|
|
|
|
|
|
public function kill ():Void;
|
|
|
public function wait (?timeout:Null<Int>):Null<Int>;
|
|
|
public function poll ():Null<Int>;
|
|
|
public function terminate ():Void;
|
|
|
|
|
|
+ public var stdout : BufferedReader;
|
|
|
+ public var stderr : BufferedReader;
|
|
|
+ public var stdin : BufferedReader;
|
|
|
+ public var returncode : Int;
|
|
|
+ public var pid:Int;
|
|
|
+
|
|
|
public function communicate (input:Bytes = null, timeout:Null<Int> = null):Tup2<Bytes, Bytes>;
|
|
|
|
|
|
- static function __init__ ():Void
|
|
|
+ static function __init__ ():Void
|
|
|
{
|
|
|
python.Macros.importFromAs("subprocess", "Popen", "python.lib.subprocess.Popen");
|
|
|
}
|