mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Add Popen.pid
This commit is contained in:
@@ -175,6 +175,10 @@ impl PopenRef {
|
||||
.communicate_bytes(stdin.into_option().as_ref().map(|bytes| bytes.get_value()))
|
||||
.map_err(|err| convert_io_error(vm, err))
|
||||
}
|
||||
|
||||
fn pid(self, _vm: &VirtualMachine) -> Option<u32> {
|
||||
self.process.borrow().pid()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
@@ -194,6 +198,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
"terminate" => ctx.new_rustfunc(PopenRef::terminate),
|
||||
"kill" => ctx.new_rustfunc(PopenRef::kill),
|
||||
"communicate" => ctx.new_rustfunc(PopenRef::communicate),
|
||||
"pid" => ctx.new_property(PopenRef::pid),
|
||||
});
|
||||
|
||||
let module = py_module!(vm, "subprocess", {
|
||||
|
||||
Reference in New Issue
Block a user