Skip to content

Commit 33a6142

Browse files
committed
Document Error::{new,other} as to be avoided in pre_exec
1 parent 733108b commit 33a6142

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/std/src/os/unix/process.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ pub trait CommandExt: Sealed {
8080
/// or acquiring a mutex are not guaranteed to work (due to
8181
/// other threads perhaps still running when the `fork` was run).
8282
///
83+
/// Note that the list of allocating functions includes [`Error::new`] and
84+
/// [`Error::other`]. To signal a non-trivial error, prefer [`panic!`].
85+
///
8386
/// For further details refer to the [POSIX fork() specification]
8487
/// and the equivalent documentation for any targeted
8588
/// platform, especially the requirements around *async-signal-safety*.
@@ -102,6 +105,8 @@ pub trait CommandExt: Sealed {
102105
/// [POSIX fork() specification]:
103106
/// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html
104107
/// [`std::env`]: mod@crate::env
108+
/// [`Error::new`]: crate::io::Error::new
109+
/// [`Error::other`]: crate::io::Error::other
105110
#[stable(feature = "process_pre_exec", since = "1.34.0")]
106111
unsafe fn pre_exec<F>(&mut self, f: F) -> &mut process::Command
107112
where

0 commit comments

Comments
 (0)