You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Sets a raw attribute on the command, providing extended configuration options for Windows processes.
241
+
/// Executes the command as a child process with the given [`ProcThreadAttributeList`], returning a handle to it.
239
242
///
240
-
/// This method allows you to specify custom attributes for a child process on Windows systems using raw attribute values.
241
-
/// Raw attributes provide extended configurability for process creation, but their usage can be complex and potentially unsafe.
242
-
///
243
-
/// The `attribute` parameter specifies the raw attribute to be set, while the `value` parameter holds the value associated with that attribute.
244
-
/// Please refer to the [`windows-rs`](https://microsoft.github.io/windows-docs-rs/doc/windows/) documentation or the [`Win32 API documentation`](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute) for detailed information about available attributes and their meanings.
243
+
/// This method enables the customization of attributes for the spawned child process on Windows systems.
244
+
/// Attributes offer extended configurability for process creation, but their usage can be intricate and potentially unsafe.
245
245
///
246
246
/// # Note
247
247
///
248
-
/// The maximum number of raw attributes is the value of [`u32::MAX`].
249
-
/// If this limit is exceeded, the call to [`process::Command::spawn`] will return an `Error` indicating that the maximum number of attributes has been exceeded.
250
-
/// # Safety
251
-
///
252
-
/// The usage of raw attributes is potentially unsafe and should be done with caution. Incorrect attribute values or improper configuration can lead to unexpected behavior or errors.
248
+
/// By default, stdin, stdout, and stderr are inherited from the parent process.
253
249
///
254
250
/// # Example
255
251
///
256
-
/// The following example demonstrates how to create a child process with a specific parent process ID using a raw attribute.
/// child_cmd.raw_attribute(PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, parent.as_raw_handle() as isize);
278
-
/// }
275
+
/// let mut child = child_cmd.spawn_with_attributes(attribute_list)?;
279
276
/// #
280
-
/// # let parent = ProcessDropGuard(parent);
281
-
///
282
-
/// let mut child = child_cmd.spawn()?;
283
-
///
284
277
/// # child.kill()?;
285
278
/// # Ok::<(), std::io::Error>(())
286
279
/// ```
287
-
///
288
-
/// # Safety Note
289
-
///
290
-
/// Remember that improper use of raw attributes can lead to undefined behavior or security vulnerabilities. Always consult the documentation and ensure proper attribute values are used.
0 commit comments