Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit 0f8e230

Browse files
docs: fix readme examples
1 parent 0b15440 commit 0f8e230

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ use pidfd::PidFd;
4040
use pidfd_getfd::{GetFdFlags, PidFdExt};
4141
use std::process::Command;
4242

43-
let child = Command::new("/usr/bin/foo").expect("failed to run `foo`");
43+
let child = Command::new("/usr/bin/foo").spawn().expect("failed to run `foo`");
4444
let pidfd = PidFd::from_std_checked(&child)?;
45-
let file_from_child = pidfd.get_file(1, GetFdFlags::empty());
45+
let file_from_child = pidfd.get_file(1, GetFdFlags::empty())?;
4646
```
4747

4848
Using nightly rustc:
4949
```rust
50+
#![feature(linux_pidfd)]
51+
5052
use pidfd_getfd::{GetFdFlags, PidFdExt};
5153
use std::{
5254
os::linux::process::{ChildExt, CommandExt},
@@ -55,6 +57,7 @@ use std::{
5557

5658
let child = Command::new("/usr/bin/foo")
5759
.create_pidfd(true)
60+
.spawn()
5861
.expect("failed to run `foo`");
5962

6063
let file_from_child = child.pidfd()?.get_file(1, GetFdFlags::empty())?;

0 commit comments

Comments
 (0)