Fix subprocess.wait to take None as a timeout argument

This commit is contained in:
Jeong YunWon committed 2020-03-13 08:24:53 +09:00
1 parent 3498a52e18
commit 7bb8998b8e
1 file changed
+8 -2
+8 -2
View File
@@ -49,6 +49,12 @@ struct PopenArgs {
start_new_session: Option<bool>,
}
#[derive(FromArgs)]
struct PopenWaitArgs {
#[pyarg(positional_or_keyword, default = "None")]
timeout: Option<u64>,
}
impl IntoPyObject for subprocess::ExitStatus {
fn into_pyobject(self, vm: &VirtualMachine) -> PyResult {
let status: i32 = match self {
@@ -142,8 +148,8 @@ impl PopenRef {
self.process.borrow().exit_status()
}
fn wait(self, timeout: OptionalArg<u64>, vm: &VirtualMachine) -> PyResult<()> {
let timeout = match timeout.into_option() {
fn wait(self, args: PopenWaitArgs, vm: &VirtualMachine) -> PyResult<()> {
let timeout = match args.timeout {
Some(timeout) => self
.process
.borrow_mut()