Skip to content

Commit 049412c

Browse files
authored
Merge pull request #1914 from mrmiywj/add_getpgrp_in_os
add getpgrp support in os mod
2 parents 6f20a80 + a80d48b commit 049412c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

vm/src/stdlib/os.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,11 @@ fn os_getpgid(pid: u32, vm: &VirtualMachine) -> PyResult {
11941194
}
11951195
}
11961196

1197+
#[cfg(unix)]
1198+
fn os_getpgrp(vm: &VirtualMachine) -> PyResult {
1199+
Ok(vm.new_int(unistd::getpgrp().as_raw()))
1200+
}
1201+
11971202
#[cfg(all(unix, not(target_os = "redox")))]
11981203
fn os_getsid(pid: u32, vm: &VirtualMachine) -> PyResult {
11991204
match unistd::getsid(Some(Pid::from_raw(pid as i32))) {
@@ -1628,6 +1633,7 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: &PyObjectRef) {
16281633
"getegid" => ctx.new_function(os_getegid),
16291634
"getpgid" => ctx.new_function(os_getpgid),
16301635
"getuid" => ctx.new_function(os_getuid),
1636+
"getpgrp" => ctx.new_function(os_getpgrp),
16311637
"geteuid" => ctx.new_function(os_geteuid),
16321638
"pipe" => ctx.new_function(os_pipe), //TODO: windows
16331639
"set_blocking" => ctx.new_function(os_set_blocking),

0 commit comments

Comments
 (0)