Files
GopherGate/target/doc/tokio/process/struct.Command.html
2026-02-26 12:00:21 -05:00

358 lines
64 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="This structure mimics the API of `std::process::Command` found in the standard library, but replaces functions that create a process with an asynchronous variant. The main provided asynchronous functions are spawn, status, and output."><title>Command in tokio::process - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="tokio" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Command</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../tokio/index.html">tokio</a><span class="version">1.49.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Command</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.arg" title="arg">arg</a></li><li><a href="#method.arg0" title="arg0">arg0</a></li><li><a href="#method.args" title="args">args</a></li><li><a href="#method.as_std" title="as_std">as_std</a></li><li><a href="#method.as_std_mut" title="as_std_mut">as_std_mut</a></li><li><a href="#method.current_dir" title="current_dir">current_dir</a></li><li><a href="#method.env" title="env">env</a></li><li><a href="#method.env_clear" title="env_clear">env_clear</a></li><li><a href="#method.env_remove" title="env_remove">env_remove</a></li><li><a href="#method.envs" title="envs">envs</a></li><li><a href="#method.get_kill_on_drop" title="get_kill_on_drop">get_kill_on_drop</a></li><li><a href="#method.gid" title="gid">gid</a></li><li><a href="#method.into_std" title="into_std">into_std</a></li><li><a href="#method.kill_on_drop" title="kill_on_drop">kill_on_drop</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.output" title="output">output</a></li><li><a href="#method.pre_exec" title="pre_exec">pre_exec</a></li><li><a href="#method.process_group" title="process_group">process_group</a></li><li><a href="#method.spawn" title="spawn">spawn</a></li><li><a href="#method.status" title="status">status</a></li><li><a href="#method.stderr" title="stderr">stderr</a></li><li><a href="#method.stdin" title="stdin">stdin</a></li><li><a href="#method.stdout" title="stdout">stdout</a></li><li><a href="#method.uid" title="uid">uid</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-Command" title="Debug">Debug</a></li><li><a href="#impl-From%3CCommand%3E-for-Command" title="From&#60;Command&#62;">From&#60;Command&#62;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Command" title="!RefUnwindSafe">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-Command" title="!UnwindSafe">!UnwindSafe</a></li><li><a href="#impl-Freeze-for-Command" title="Freeze">Freeze</a></li><li><a href="#impl-Send-for-Command" title="Send">Send</a></li><li><a href="#impl-Sync-for-Command" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Command" title="Unpin">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow&#60;T&#62;">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut&#60;T&#62;">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into&#60;U&#62;">Into&#60;U&#62;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom&#60;U&#62;">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto&#60;U&#62;">TryInto&#60;U&#62;</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In tokio::<wbr>process</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">tokio</a>::<wbr><a href="index.html">process</a></div><h1>Struct <span class="struct">Command</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/tokio/process/mod.rs.html#274-277">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Command { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This structure mimics the API of <a href="https://doc.rust-lang.org/1.93.1/std/process/struct.Command.html" title="struct std::process::Command"><code>std::process::Command</code></a> found in the standard library, but
replaces functions that create a process with an asynchronous variant. The main provided
asynchronous functions are <a href="struct.Command.html#method.spawn" title="method tokio::process::Command::spawn">spawn</a>, <a href="struct.Command.html#method.status" title="method tokio::process::Command::status">status</a>, and
<a href="struct.Command.html#method.output" title="method tokio::process::Command::output">output</a>.</p>
<p><code>Command</code> uses asynchronous versions of some <code>std</code> types (for example <a href="struct.Child.html" title="struct tokio::process::Child"><code>Child</code></a>).</p>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Command" class="impl"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#286-1093">Source</a><a href="#impl-Command" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#317-319">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>&lt;S: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;&gt;(program: S) -&gt; <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Constructs a new <code>Command</code> for launching the program at
path <code>program</code>, with the following default configuration:</p>
<ul>
<li>No arguments to the program</li>
<li>Inherit the current processs environment</li>
<li>Inherit the current processs working directory</li>
<li>Inherit stdin/stdout/stderr for <code>spawn</code> or <code>status</code>, but create pipes for <code>output</code></li>
</ul>
<p>Builder methods are provided to change these defaults and
otherwise configure the process.</p>
<p>If <code>program</code> is not an absolute path, the <code>PATH</code> will be searched in
an OS-defined way.</p>
<p>The search path to be used may be controlled by setting the
<code>PATH</code> environment variable on the Command,
but this has some implementation limitations on Windows
(see issue <a href="https://github.com/rust-lang/rust/issues/37519">rust-lang/rust#37519</a>).</p>
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span><span class="kw-2">mut </span>command = Command::new(<span class="string">"sh"</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_std" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#323-325">Source</a><h4 class="code-header">pub fn <a href="#method.as_std" class="fn">as_std</a>(&amp;self) -&gt; &amp;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Command.html" title="struct std::process::Command">StdCommand</a></h4></section></summary><div class="docblock"><p>Cheaply convert to a <code>&amp;std::process::Command</code> for places where the type from the standard
library is expected.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_std_mut" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#329-331">Source</a><h4 class="code-header">pub fn <a href="#method.as_std_mut" class="fn">as_std_mut</a>(&amp;mut self) -&gt; &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Command.html" title="struct std::process::Command">StdCommand</a></h4></section></summary><div class="docblock"><p>Cheaply convert to a <code>&amp;mut std::process::Command</code> for places where the type from the
standard library is expected.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_std" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#338-340">Source</a><h4 class="code-header">pub fn <a href="#method.into_std" class="fn">into_std</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Command.html" title="struct std::process::Command">StdCommand</a></h4></section></summary><div class="docblock"><p>Cheaply convert into a <code>std::process::Command</code>.</p>
<p>Note that Tokio specific options will be lost. Currently, this only applies to <a href="struct.Command.html#method.kill_on_drop" title="method tokio::process::Command::kill_on_drop"><code>kill_on_drop</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.arg" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#382-385">Source</a><h4 class="code-header">pub fn <a href="#method.arg" class="fn">arg</a>&lt;S: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;&gt;(&amp;mut self, arg: S) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Adds an argument to pass to the program.</p>
<p>Only one argument can be passed per use. So instead of:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>command = tokio::process::Command::new(<span class="string">"sh"</span>);
command.arg(<span class="string">"-C /path/to/repo"</span>);
</code></pre></div>
<p>usage would be:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>command = tokio::process::Command::new(<span class="string">"sh"</span>);
command.arg(<span class="string">"-C"</span>);
command.arg(<span class="string">"/path/to/repo"</span>);
</code></pre></div>
<p>To pass multiple arguments see <a href="struct.Command.html#method.args" title="method tokio::process::Command::args"><code>args</code></a>.</p>
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.arg(<span class="string">"-l"</span>)
.arg(<span class="string">"-a"</span>)
.output().<span class="kw">await</span>.unwrap();
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.args" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#406-413">Source</a><h4 class="code-header">pub fn <a href="#method.args" class="fn">args</a>&lt;I, S&gt;(&amp;mut self, args: I) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a><div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = S&gt;,
S: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Adds multiple arguments to pass to the program.</p>
<p>To pass a single argument see <a href="struct.Command.html#method.arg" title="method tokio::process::Command::arg"><code>arg</code></a>.</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.args(<span class="kw-2">&amp;</span>[<span class="string">"-l"</span>, <span class="string">"-a"</span>])
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.env" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#444-451">Source</a><h4 class="code-header">pub fn <a href="#method.env" class="fn">env</a>&lt;K, V&gt;(&amp;mut self, key: K, val: V) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a><div class="where">where
K: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;,
V: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Inserts or updates an environment variable mapping.</p>
<p>Note that environment variable names are case-insensitive (but case-preserving) on Windows,
and case-sensitive on all other platforms.</p>
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.env(<span class="string">"PATH"</span>, <span class="string">"/bin"</span>)
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.envs" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#479-487">Source</a><h4 class="code-header">pub fn <a href="#method.envs" class="fn">envs</a>&lt;I, K, V&gt;(&amp;mut self, vars: I) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a><div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.tuple.html">(K, V)</a>&gt;,
K: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;,
V: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Adds or updates multiple environment variable mappings.</p>
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">use </span>std::process::{Stdio};
<span class="kw">use </span>std::env;
<span class="kw">use </span>std::collections::HashMap;
<span class="kw">let </span>filtered_env : HashMap&lt;String, String&gt; =
env::vars().filter(|<span class="kw-2">&amp;</span>(<span class="kw-2">ref </span>k, <span class="kw">_</span>)|
k == <span class="string">"TERM" </span>|| k == <span class="string">"TZ" </span>|| k == <span class="string">"LANG" </span>|| k == <span class="string">"PATH"
</span>).collect();
<span class="kw">let </span>output = Command::new(<span class="string">"printenv"</span>)
.stdin(Stdio::null())
.stdout(Stdio::inherit())
.env_clear()
.envs(<span class="kw-2">&amp;</span>filtered_env)
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.env_remove" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#504-507">Source</a><h4 class="code-header">pub fn <a href="#method.env_remove" class="fn">env_remove</a>&lt;K: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;&gt;(&amp;mut self, key: K) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Removes an environment variable mapping.</p>
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.env_remove(<span class="string">"PATH"</span>)
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.env_clear" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#524-527">Source</a><h4 class="code-header">pub fn <a href="#method.env_clear" class="fn">env_clear</a>(&amp;mut self) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Clears the entire environment map for the child process.</p>
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.env_clear()
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.current_dir" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#554-557">Source</a><h4 class="code-header">pub fn <a href="#method.current_dir" class="fn">current_dir</a>&lt;P: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt;(&amp;mut self, dir: P) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the working directory for the child process.</p>
<h5 id="platform-specific-behavior"><a class="doc-anchor" href="#platform-specific-behavior">§</a>Platform-specific behavior</h5>
<p>If the program path is relative (e.g., <code>"./script.sh"</code>), its ambiguous
whether it should be interpreted relative to the parents working
directory or relative to <code>current_dir</code>. The behavior in this case is
platform specific and unstable, and its recommended to use
<a href="../fs/fn.canonicalize.html" title="fn tokio::fs::canonicalize"><code>canonicalize</code></a> to get an absolute program path instead.</p>
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.current_dir(<span class="string">"/bin"</span>)
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.stdin" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#579-582">Source</a><h4 class="code-header">pub fn <a href="#method.stdin" class="fn">stdin</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a>&gt;&gt;(&amp;mut self, cfg: T) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets configuration for the child processs standard input (stdin) handle.</p>
<p>Defaults to <a href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html#method.inherit" title="associated function std::process::Stdio::inherit"><code>inherit</code></a>.</p>
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::process::{Stdio};
<span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.stdin(Stdio::null())
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.stdout" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#606-609">Source</a><h4 class="code-header">pub fn <a href="#method.stdout" class="fn">stdout</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a>&gt;&gt;(&amp;mut self, cfg: T) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets configuration for the child processs standard output (stdout) handle.</p>
<p>Defaults to <a href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html#method.inherit" title="associated function std::process::Stdio::inherit"><code>inherit</code></a> when used with <code>spawn</code> or <code>status</code>, and
defaults to <a href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html#method.piped" title="associated function std::process::Stdio::piped"><code>piped</code></a> when used with <code>output</code>.</p>
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">use </span>std::process::Stdio;
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.stdout(Stdio::null())
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.stderr" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#633-636">Source</a><h4 class="code-header">pub fn <a href="#method.stderr" class="fn">stderr</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a>&gt;&gt;(&amp;mut self, cfg: T) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets configuration for the child processs standard error (stderr) handle.</p>
<p>Defaults to <a href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html#method.inherit" title="associated function std::process::Stdio::inherit"><code>inherit</code></a> when used with <code>spawn</code> or <code>status</code>, and
defaults to <a href="https://doc.rust-lang.org/1.93.1/std/process/struct.Stdio.html#method.piped" title="associated function std::process::Stdio::piped"><code>piped</code></a> when used with <code>output</code>.</p>
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">use </span>std::process::{Stdio};
<span class="kw">let </span>output = Command::new(<span class="string">"ls"</span>)
.stderr(Stdio::null())
.output().<span class="kw">await</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.kill_on_drop" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#664-667">Source</a><h4 class="code-header">pub fn <a href="#method.kill_on_drop" class="fn">kill_on_drop</a>(&amp;mut self, kill_on_drop: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Controls whether a <code>kill</code> operation should be invoked on a spawned child
process when its corresponding <code>Child</code> handle is dropped.</p>
<p>By default, this value is assumed to be <code>false</code>, meaning the next spawned
process will not be killed on drop, similar to the behavior of the standard
library.</p>
<h5 id="caveats"><a class="doc-anchor" href="#caveats">§</a>Caveats</h5>
<p>On Unix platforms processes must be “reaped” by their parent process after
they have exited in order to release all OS resources. A child process which
has exited, but has not yet been reaped by its parent is considered a “zombie”
process. Such processes continue to count against limits imposed by the system,
and having too many zombie processes present can prevent additional processes
from being spawned.</p>
<p>Although issuing a <code>kill</code> signal to the child process is a synchronous
operation, the resulting zombie process cannot be <code>.await</code>ed inside of the
destructor to avoid blocking other tasks. The tokio runtime will, on a
best-effort basis, attempt to reap and clean up such processes in the
background, but no additional guarantees are made with regard to
how quickly or how often this procedure will take place.</p>
<p>If stronger guarantees are required, it is recommended to avoid dropping
a <a href="struct.Child.html" title="struct tokio::process::Child"><code>Child</code></a> handle where possible, and instead utilize <code>child.wait().await</code>
or <code>child.kill().await</code> where possible.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.uid" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#686-691">Source</a><h4 class="code-header">pub fn <a href="#method.uid" class="fn">uid</a>(&amp;mut self, id: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the child processs user ID. This translates to a
<code>setuid</code> call in the child process. Failure in the <code>setuid</code>
call will cause the spawn to fail.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.gid" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#697-702">Source</a><h4 class="code-header">pub fn <a href="#method.gid" class="fn">gid</a>(&amp;mut self, id: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Similar to <code>uid</code> but sets the group ID of the child process. This has
the same semantics as the <code>uid</code> field.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.arg0" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#710-716">Source</a><h4 class="code-header">pub fn <a href="#method.arg0" class="fn">arg0</a>&lt;S&gt;(&amp;mut self, arg: S) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a><div class="where">where
S: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Sets executable argument.</p>
<p>Set the first process argument, <code>argv[0]</code>, to something other than the
default executable path.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pre_exec" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#749-755">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.pre_exec" class="fn">pre_exec</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>() -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Schedules a closure to be run just before the <code>exec</code> function is
invoked.</p>
<p>The closure is allowed to return an I/O error whose OS error code will
be communicated back to the parent and returned as an error from when
the spawn was requested.</p>
<p>Multiple closures can be registered and they will be called in order of
their registration. If a closure returns <code>Err</code> then no further closures
will be called and the spawn operation will immediately return with a
failure.</p>
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
<p>This closure will be run in the context of the child process after a
<code>fork</code>. This primarily means that any modifications made to memory on
behalf of this closure will <strong>not</strong> be visible to the parent process.
This is often a very constrained environment where normal operations
like <code>malloc</code> or acquiring a mutex are not guaranteed to work (due to
other threads perhaps still running when the <code>fork</code> was run).</p>
<p>This also means that all resources such as file descriptors and
memory-mapped regions got duplicated. It is your responsibility to make
sure that the closure does not violate library invariants by making
invalid use of these duplicates.</p>
<p>When this closure is run, aspects such as the stdio file descriptors and
working directory have successfully been changed, so output to these
locations may not appear where intended.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.process_group" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#790-793">Source</a><h4 class="code-header">pub fn <a href="#method.process_group" class="fn">process_group</a>(&amp;mut self, pgroup: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -&gt; &amp;mut <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the process group ID (PGID) of the child process. Equivalent to a
<code>setpgid</code> call in the child process, but may be more efficient.</p>
<p>Process groups determine which processes receive signals.</p>
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
<p>Pressing Ctrl-C in a terminal will send <code>SIGINT</code> to all processes
in the current foreground process group. By spawning the <code>sleep</code>
subprocess in a new process group, it will not receive <code>SIGINT</code>
from the terminal.</p>
<p>The parent process could install a <a href="../signal/index.html" title="mod tokio::signal">signal handler</a> and manage the
process on its own terms.</p>
<p>A process group ID of 0 will use the process ID as the PGID.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span>output = Command::new(<span class="string">"sleep"</span>)
.arg(<span class="string">"10"</span>)
.process_group(<span class="number">0</span>)
.output()
.<span class="kw">await
</span>.unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.spawn" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#863-867">Source</a><h4 class="code-header">pub fn <a href="#method.spawn" class="fn">spawn</a>(&amp;mut self) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="struct.Child.html" title="struct tokio::process::Child">Child</a>&gt;</h4></section></summary><div class="docblock"><p>Executes the command as a child process, returning a handle to it.</p>
<p>By default, stdin, stdout and stderr are inherited from the parent.</p>
<p>This method will spawn the child process synchronously and return a
handle to a future-aware child process. The <code>Child</code> returned implements
<code>Future</code> itself to acquire the <code>ExitStatus</code> of the child, and otherwise
the <code>Child</code> has methods to acquire handles to the stdin, stdout, and
stderr streams.</p>
<p>All I/O this child does will be associated with the current default
event loop.</p>
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">async fn </span>run_ls() -&gt; std::process::ExitStatus {
Command::new(<span class="string">"ls"</span>)
.spawn()
.expect(<span class="string">"ls command failed to start"</span>)
.wait()
.<span class="kw">await
</span>.expect(<span class="string">"ls command failed to run"</span>)
}</code></pre></div><h5 id="caveats-1"><a class="doc-anchor" href="#caveats-1">§</a>Caveats</h5><h6 id="droppingcancellation"><a class="doc-anchor" href="#droppingcancellation">§</a>Dropping/Cancellation</h6>
<p>Similar to the behavior to the standard library, and unlike the futures
paradigm of dropping-implies-cancellation, a spawned process will, by
default, continue to execute even after the <code>Child</code> handle has been dropped.</p>
<p>The <a href="struct.Command.html#method.kill_on_drop" title="method tokio::process::Command::kill_on_drop"><code>Command::kill_on_drop</code></a> method can be used to modify this behavior
and kill the child process if the <code>Child</code> wrapper is dropped before it
has exited.</p>
<h6 id="unix-processes"><a class="doc-anchor" href="#unix-processes">§</a>Unix Processes</h6>
<p>On Unix platforms processes must be “reaped” by their parent process after
they have exited in order to release all OS resources. A child process which
has exited, but has not yet been reaped by its parent is considered a “zombie”
process. Such processes continue to count against limits imposed by the system,
and having too many zombie processes present can prevent additional processes
from being spawned.</p>
<p>The tokio runtime will, on a best-effort basis, attempt to reap and clean up
any process which it has spawned. No additional guarantees are made with regard to
how quickly or how often this procedure will take place.</p>
<p>It is recommended to avoid dropping a <a href="struct.Child.html" title="struct tokio::process::Child"><code>Child</code></a> process handle before it has been
fully <code>await</code>ed if stricter cleanup guarantees are required.</p>
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
<p>On Unix platforms this method will fail with <code>std::io::ErrorKind::WouldBlock</code>
if the system process limit is reached (which includes other applications
running on the system).</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.status" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#1002-1017">Source</a><h4 class="code-header">pub fn <a href="#method.status" class="fn">status</a>(&amp;mut self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = <a class="type" href="https://doc.rust-lang.org/1.93.1/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.ExitStatus.html" title="struct std::process::ExitStatus">ExitStatus</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Executes the command as a child process, waiting for it to finish and
collecting its exit status.</p>
<p>By default, stdin, stdout and stderr are inherited from the parent.
If any input/output handles are set to a pipe then they will be immediately
closed after the child is spawned.</p>
<p>All I/O this child does will be associated with the current default
event loop.</p>
<p>The destructor of the future returned by this function will kill
the child if <a href="struct.Command.html#method.kill_on_drop" title="method tokio::process::Command::kill_on_drop"><code>kill_on_drop</code></a> is set to true.</p>
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
<p>This future will return an error if the child process cannot be spawned
or if there is an error while awaiting its status.</p>
<p>On Unix platforms this method will fail with <code>std::io::ErrorKind::WouldBlock</code>
if the system process limit is reached (which includes other applications
running on the system).</p>
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">async fn </span>run_ls() -&gt; std::process::ExitStatus {
Command::new(<span class="string">"ls"</span>)
.status()
.<span class="kw">await
</span>.expect(<span class="string">"ls command failed to run"</span>)
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.output" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#1065-1072">Source</a><h4 class="code-header">pub fn <a href="#method.output" class="fn">output</a>(&amp;mut self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = <a class="type" href="https://doc.rust-lang.org/1.93.1/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Output.html" title="struct std::process::Output">Output</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Executes the command as a child process, waiting for it to finish and
collecting all of its output.</p>
<blockquote>
<p><strong>Note</strong>: this method, unlike the standard library, will
unconditionally configure the stdout/stderr handles to be pipes, even
if they have been previously configured. If this is not desired then
the <code>spawn</code> method should be used in combination with the
<code>wait_with_output</code> method on child.</p>
</blockquote>
<p>This method will return a future representing the collection of the
child processs stdout/stderr. It will resolve to
the <code>Output</code> type in the standard library, containing <code>stdout</code> and
<code>stderr</code> as <code>Vec&lt;u8&gt;</code> along with an <code>ExitStatus</code> representing how the
process exited.</p>
<p>All I/O this child does will be associated with the current default
event loop.</p>
<p>The destructor of the future returned by this function will kill
the child if <a href="struct.Command.html#method.kill_on_drop" title="method tokio::process::Command::kill_on_drop"><code>kill_on_drop</code></a> is set to true.</p>
<h5 id="errors-2"><a class="doc-anchor" href="#errors-2">§</a>Errors</h5>
<p>This future will return an error if the child process cannot be spawned
or if there is an error while awaiting its status.</p>
<p>On Unix platforms this method will fail with <code>std::io::ErrorKind::WouldBlock</code>
if the system process limit is reached (which includes other applications
running on the system).</p>
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">async fn </span>run_ls() {
<span class="kw">let </span>output: std::process::Output = Command::new(<span class="string">"ls"</span>)
.output()
.<span class="kw">await
</span>.expect(<span class="string">"ls command failed to run"</span>);
<span class="macro">println!</span>(<span class="string">"stderr of ls: {:?}"</span>, output.stderr);
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_kill_on_drop" class="method"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#1090-1092">Source</a><h4 class="code-header">pub fn <a href="#method.get_kill_on_drop" class="fn">get_kill_on_drop</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns the boolean value that was previously set by <a href="struct.Command.html#method.kill_on_drop" title="method tokio::process::Command::kill_on_drop"><code>Command::kill_on_drop</code></a>.</p>
<p>Note that if you have not previously called <a href="struct.Command.html#method.kill_on_drop" title="method tokio::process::Command::kill_on_drop"><code>Command::kill_on_drop</code></a>, the
default value of <code>false</code> will be returned here.</p>
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::process::Command;
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"echo"</span>);
<span class="macro">assert!</span>(!cmd.get_kill_on_drop());
cmd.kill_on_drop(<span class="bool-val">true</span>);
<span class="macro">assert!</span>(cmd.get_kill_on_drop());</code></pre></div></div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Command" class="impl"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#273">Source</a><a href="#impl-Debug-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#273">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CCommand%3E-for-Command" class="impl"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#1095-1102">Source</a><a href="#impl-From%3CCommand%3E-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Command.html" title="struct std::process::Command">Command</a>&gt; for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../../src/tokio/process/mod.rs.html#1096-1101">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(std: <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/process/struct.Command.html" title="struct std::process::Command">StdCommand</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Command" class="impl"><a href="#impl-Freeze-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section><section id="impl-RefUnwindSafe-for-Command" class="impl"><a href="#impl-RefUnwindSafe-for-Command" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section><section id="impl-Send-for-Command" class="impl"><a href="#impl-Send-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section><section id="impl-Sync-for-Command" class="impl"><a href="#impl-Sync-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section><section id="impl-Unpin-for-Command" class="impl"><a href="#impl-Unpin-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section><section id="impl-UnwindSafe-for-Command" class="impl"><a href="#impl-UnwindSafe-for-Command" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Command.html" title="struct tokio::process::Command">Command</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#785">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#788">Source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#767-769">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#777">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#827-829">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#831">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#834">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#811-813">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#815">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#818">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>