(
path: OsPath,
argv: Either<PyListRef, PyTupleRef>,
vm: &VirtualMachine,
)
| 1292 | |
| 1293 | #[pyfunction] |
| 1294 | fn execv( |
| 1295 | path: OsPath, |
| 1296 | argv: Either<PyListRef, PyTupleRef>, |
| 1297 | vm: &VirtualMachine, |
| 1298 | ) -> PyResult<()> { |
| 1299 | let path = path.into_cstring(vm)?; |
| 1300 | |
| 1301 | let argv = vm.extract_elements_with(argv.as_ref(), |obj| { |
| 1302 | OsPath::try_from_object(vm, obj)?.into_cstring(vm) |
| 1303 | })?; |
| 1304 | let argv: Vec<&CStr> = argv.iter().map(|entry| entry.as_c_str()).collect(); |
| 1305 | |
| 1306 | let first = argv |
| 1307 | .first() |
| 1308 | .ok_or_else(|| vm.new_value_error("execv() arg 2 must not be empty"))?; |
| 1309 | if first.to_bytes().is_empty() { |
| 1310 | return Err(vm.new_value_error("execv() arg 2 first element cannot be empty")); |
| 1311 | } |
| 1312 | |
| 1313 | unistd::execv(&path, &argv) |
| 1314 | .map(|_ok| ()) |
| 1315 | .map_err(|err| err.into_pyexception(vm)) |
| 1316 | } |
| 1317 | |
| 1318 | #[pyfunction] |
| 1319 | fn execve( |
nothing calls this directly
no test coverage detected