about summary refs log tree commit diff
path: root/src/libstd/process.rs
AgeCommit message (Collapse)AuthorLines
2017-05-20Stabilize library features for 1.18.0Steven Fackler-3/+1
Closes #38863 Closes #38980 Closes #38903 Closes #36648
2017-05-18Add documentation for `ExitStatus`Michael Kohl-0/+23
As requested in #29370.
2017-05-03Update ChildStdin/ChildStdout docs to be clearerMichael Gattozzi-4/+6
2017-05-01Fix incorrect hex value in doc comment example.Corey Farwell-1/+1
2017-04-20Rollup merge of #40812 - mgattozzi:ChildDocs, r=steveklabnikCorey Farwell-11/+9
Update `Child` docs to not have a note section In #29370 it's noted that for "the Note shouldn't be one, and should come before the examples." This commit changes the positioning of the section and removes wording that said take note in order for it to flow better with the surrounding text and it's new position.
2017-04-19Fix link for waitMichael Gattozzi-1/+1
2017-04-09Auto merge of #40829 - mgattozzi:ChildStderr, r=steveklabnikbors-2/+3
Update ChildStderr docs to be clearer Before the docs only had a line about where it was found and that it was a handle to stderr. This commit changes it so that the summary second line is removed and that it's a bit clearer about what can be done with it. Part of #29370
2017-04-06Update process.rsraph-3/+2
2017-04-05Add example to std::process::abortraph-0/+22
This is a second (2/3?) step in order to complete this issue: https://github.com/rust-lang/rust/issues/29370 I submitted this PR with the help of @steveklabnik again. Thanks to him! More info here: https://github.com/rust-lang/rust/issues/29370#issuecomment-290653877
2017-04-04Change docs to follow review requestsMichael Gattozzi-3/+3
2017-03-30Update process.rsraph-1/+1
2017-03-29Removing trailing spacesraph-3/+3
2017-03-29adding ///raph-0/+1
2017-03-29Add example to std::process::abortraph-0/+13
2017-03-25Update ChildStderr docs to be clearerMichael Gattozzi-2/+3
Before the docs only had a line about where it was found and that it was a handle to stderr. This commit changes it so that the summary second line is removed and that it's a bit clearer about what can be done with it. Part of \#29370
2017-03-25Remove extra wait from Child docsMichael Gattozzi-1/+1
2017-03-24Update `Child` docs to not have a note sectionMichael Gattozzi-11/+9
In #29370 it's noted that for "the Note shouldn't be one, and should come before the examples." This commit changes the positioning of the section and removes wording that said take note in order for it to flow better with the surrounding text and it's new position.
2017-03-24Add a missing feature attribute to the example for ↵Petr Zemek-0/+2
std::process::Command::envs(). The person who originally wrote the example forgot to include this attribute. This caused Travis CI to fail on commit 9b0a4a4e97 (#40794), which just fixed formatting in the description of std::process::Command::envs().
2017-03-24Fix formatting in the docs for std::process::Command::envs().Petr Zemek-0/+1
An empty line between the "Basic usage:" text and the example is required to properly format the code. Without the empty line, the example is not formatted as code.
2017-03-20Rollup merge of #40312 - jdhorwitz:papercut, r=steveklabnikCorey Farwell-0/+21
Papercut r? @steveklabnik
2017-03-17Stabilize process_abort feature, closes #37838Aaron Turon-1/+1
2017-03-09Removed RustFMT changesJoshua Horwitz-0/+21
2017-02-27Example for how to provide stdin using std::process::CommandRobin Stocker-0/+25
Spawning a child process and writing to its stdin is a bit tricky due to `as_mut` and having to use a limited borrow. An example for this might help newer users.
2017-02-06make Child::try_wait return io::Result<Option<ExitStatus>>Jack O'Connor-8/+7
This is much nicer for callers who want to short-circuit real I/O errors with `?`, because they can write this if let Some(status) = foo.try_wait()? { ... } else { ... } instead of this match foo.try_wait() { Ok(status) => { ... } Err(err) if err.kind() == io::ErrorKind::WouldBlock => { ... } Err(err) => return Err(err), } The original design of `try_wait` was patterned after the `Read` and `Write` traits, which support both blocking and non-blocking implementations in a single API. But since `try_wait` is never blocking, it makes sense to optimize for the non-blocking case. Tracking issue: https://github.com/rust-lang/rust/issues/38903
2017-02-05Rollup merge of #39393 - ollie27:stab_impls, r=alexcrichtonCorey Farwell-5/+5
Fix a few impl stability attributes The versions show up in rustdoc.
2017-02-05Rollup merge of #38518 - nagisa:exec-doc, r=alexcrichtonCorey Farwell-2/+19
Expand documentation of process::exit and exec Show a conventional way to use process::exit when destructors are considered important and also mention that the same caveats wrt destructors apply to exec as well.
2017-01-29Fix a few impl stability attributesOliver Middleton-5/+5
The versions show up in rustdoc.
2017-01-25Auto merge of #38856 - zackw:process-envs, r=aturonbors-1/+36
Add std::process::Command::envs() `Command::envs()` adds a vector of key-value pairs to the child process environment all at once. Suggested in #38526. This is not fully baked and frankly I'm not sure it even _works_, but I need some help finishing it up, and this is the simplest way to show you what I've got. The problems I know exist and don't know how to solve, from most to least important, are: * [ ] I don't know if the type signature of the new function is correct. * [x] The new test might not be getting run. I didn't see it go by in the output of `x.py test src/libstd --stage 1`. * [x] The tidy check says ``process.rs:402: different `since` than before`` which I don't know what it means. r? @brson
2017-01-21Generalize envs() and args() to iterators.Zack Weinberg-6/+9
* Command::envs() now takes anything that is IntoIterator<Item=(K, V)> where both K and V are AsRef<OsStr>. * Since we're not 100% sure that's the right signature, envs() is now marked unstable. (You can use envs() with HashMap<str, str> but not Vec<(str, str)>, for instance.) * Update the test to match. * By analogy, args() now takes any IntoIterator<Item=S>, S: AsRef<OsStr>. This should be uncontroversial.
2017-01-19Expand documentation of process::exit and execSimonas Kazlauskas-2/+19
Show a conventional way to use process::exit when destructors are considered important and also mention that the same caveats wrt destructors apply to exec as well.
2017-01-10Fixes:Zack Weinberg-1/+1
* give the new feature its own feature tag * correct a lifetime problem in the test * use .output() instead of .spawn() in the test so that output is actually collected * correct the same error in the test whose skeleton I cribbed
2017-01-09Auto merge of #38866 - alexcrichton:try-wait, r=aturonbors-0/+42
std: Add a nonblocking `Child::try_wait` method This commit adds a new method to the `Child` type in the `std::process` module called `try_wait`. This method is the same as `wait` except that it will not block the calling thread and instead only attempt to collect the exit status. On Unix this means that we call `waitpid` with the `WNOHANG` flag and on Windows it just means that we pass a 0 timeout to `WaitForSingleObject`. Currently it's possible to build this method out of tree, but it's unfortunately tricky to do so. Specifically on Unix you essentially lose ownership of the pid for the process once a call to `waitpid` has succeeded. Although `Child` tracks this state internally to be resilient to multiple calls to `wait` or a `kill` after a successful wait, if the child is waited on externally then the state inside of `Child` is not updated. This means that external implementations of this method must be extra careful to essentially not use a `Child`'s methods after a call to `waitpid` has succeeded (even in a nonblocking fashion). By adding this functionality to the standard library it should help canonicalize these external implementations and ensure they can continue to robustly reuse the `Child` type from the standard library without worrying about pid ownership.
2017-01-06std: Add a nonblocking `Child::try_wait` methodAlex Crichton-0/+42
This commit adds a new method to the `Child` type in the `std::process` module called `try_wait`. This method is the same as `wait` except that it will not block the calling thread and instead only attempt to collect the exit status. On Unix this means that we call `waitpid` with the `WNOHANG` flag and on Windows it just means that we pass a 0 timeout to `WaitForSingleObject`. Currently it's possible to build this method out of tree, but it's unfortunately tricky to do so. Specifically on Unix you essentially lose ownership of the pid for the process once a call to `waitpid` has succeeded. Although `Child` tracks this state internally to be resilient to multiple calls to `wait` or a `kill` after a successful wait, if the child is waited on externally then the state inside of `Child` is not updated. This means that external implementations of this method must be extra careful to essentially not use a `Child`'s methods after a call to `waitpid` has succeeded (even in a nonblocking fashion). By adding this functionality to the standard library it should help canonicalize these external implementations and ensure they can continue to robustly reuse the `Child` type from the standard library without worrying about pid ownership.
2017-01-05Add std::process::Command::envs()Zack Weinberg-0/+32
Command::envs() adds a vector of key-value pairs to the child process environment all at once. Suggested in #38526.
2017-01-04Fix formattingabhijeetbhagat-1/+1
2017-01-04Fix formattingabhijeetbhagat-10/+10
2017-01-03Fix process module tests to run on Windowsabhijeetbhagat-18/+67
2016-12-20Rollup merge of #38006 - frewsxcv:libstd-debug, r=alexcrichtonAlex Crichton-0/+39
Implement `fmt::Debug` for all structures in libstd. Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-0/+39
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-18Document platform-specific differences for `std::process::exit`.Corey Farwell-0/+17
Fixes https://github.com/rust-lang/rust/issues/35046.
2016-12-07Rollup merge of #38151 - GuillaumeGomez:exit-examples, r=frewsxcvGuillaume Gomez-0/+8
Add examples for exit function r? @frewsxcv
2016-12-05Auto merge of #38098 - luser:windows-commandext, r=alexcrichtonbors-0/+58
Add std::os::windows::process::CommandExt. Fixes #37827 This adds a CommandExt trait for Windows along with an implementation of it for std::process::Command with methods to set the process creation flags that are passed to CreateProcess.
2016-12-03Add examples for exit functionGuillaume Gomez-0/+8
2016-12-01Auto merge of #38018 - sourcefrog:doc, r=alexcrichtonbors-0/+8
Document that Process::command will search the PATH
2016-11-30just add one method named creation_flags, fix the tidy errorTed Mielczarek-2/+3
2016-11-30Document that Process::command will search the PATHMartin Pool-0/+8
2016-11-30Add std::os::windows::process::CommandExt, with set_creation_flags and ↵Ted Mielczarek-0/+57
add_creation_flags methods. Fixes #37827 This adds a CommandExt trait for Windows along with an implementation of it for std::process::Command with methods to set the process creation flags that are passed to CreateProcess.
2016-11-17Add std::process::abortSteven Fackler-0/+15
This calls libc abort on Unix and fastfail on Windows.
2016-09-30Auto merge of #36339 - brson:emscripten-new, r=alexcrichtonbors-1/+1
Working asmjs and wasm targets This patch set results in a working standard library for the asmjs-unknown-emscripten and wasm32-unknown-emscripten targets. It is based on the work of @badboy and @rschulman. It does a few things: - Updates LLVM with the emscripten [fastcomp](https://github.com/rust-lang/llvm/pull/50) patches, which include the pnacl IR legalizer and the asm.js backend. This patch is thought not to have any significant effect on existing targets. - Teaches rustbuild to correctly link C code with emscripten - Updates gcc-rs to work correctly with emscripten - Teaches rustbuild to run crate tests for emscripten with node - Modifies Thread::new to return an error on emscripten, to facilitate debugging a common failure mode - Modifies libtest to run in single-threaded mode for emscripten - Ignores a host of tests that don't work yet, mostly dealing with threads and I/O - Updates libc with wasm32 definitions (presently the same as asmjs) - Adds a wasm32-unknown-emscripten target that feeds the output of LLVM's asmjs backend through emcc to generate wasm Notes and caveats: - This is only known to work with `--enable-rustbuild`. - The wasm32 target can't be tested correctly yet because of issues in compiletest and limitations in node https://github.com/kripken/emscripten/issues/4542, but hello.rs does seem to work when run on node via the binaryen interpreter - This requires an up to date installation of the emscripten sdk from its incoming branch - Unwinding is very broken - When enabling the emscripten targets jemalloc is disabled for all targets, which results in test failures for the host Next steps are to fix the jemalloc issue, start building the two emscripten targets on the auto builders, then start producing nightlies. https://github.com/rust-lang/rust/issues/36317 tracks work on this. Fixes https://github.com/rust-lang/rust/issues/36515 Fixes https://github.com/rust-lang/rust/issues/36515 Fixes https://github.com/rust-lang/rust/issues/36356
2016-09-30Ignore entire test modules on emscripten instead of individual testsBrian Anderson-18/+1