about summary refs log tree commit diff
path: root/src/libstd/process.rs
AgeCommit message (Collapse)AuthorLines
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
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+17
2016-09-30Improve process module doc a bitGuillaume Gomez-1/+19
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-2/+0
2016-07-12Add doc example for `std::process::ExitStatus::success`.Corey Farwell-0/+17
2016-07-11`std::process` doc improvements.Corey Farwell-11/+29
* Link to `process::Command` from `process::Child`. * Move out inline Markdown link in doc comment. * Link to `process::Child::wait` from `process::Child`. * Link to `process::Child` from `process::ChildStdin`. * Link to `process::Child` from `process::ChildStdout`. * Link to `process::Child` from `process::ChildStderr`.
2016-06-16doc: fix mis-named binding & remove not needed `mut`Tshepang Lekhonkhobe-8/+9
2016-06-09doc: intro should be 1 sentenceTshepang Lekhonkhobe-2/+4
Also, do not repeat name of type
2016-06-02doc: typoTshepang Lekhonkhobe-1/+1
2016-05-09Auto merge of #33224 - alexcrichton:create-exit-status, r=aturonbors-0/+6
std: Allow creating ExitStatus from raw values Sometimes a process may be waited on externally from the standard library, in which case it can be useful to create a raw `ExitStatus` structure to return. This commit extends the existing Unix `ExitStatusExt` extension trait and adds a new Windows-specific `ExitStatusExt` extension trait to do this. The methods are currently called `ExitStatus::from_raw`. cc #32713
2016-05-01Add process types documentationGuillaume Gomez-4/+196
2016-04-26std: Allow creating ExitStatus from raw valuesAlex Crichton-0/+6
Sometimes a process may be waited on externally from the standard library, in which case it can be useful to create a raw `ExitStatus` structure to return. This commit extends the existing Unix `ExitStatusExt` extension trait and adds a new Windows-specific `ExitStatusExt` extension trait to do this. The methods are currently called `ExitStatus::from_raw`. cc #32713
2016-04-15Auto merge of #32338 - lukaspustina:doc-std-process, r=alexcrichtonbors-11/+37
Extends rustdoc on how to caputure output - The documentation is quite about how to caputure a process' output when using ` std::process::Child::wait_with_output()`. - This PR adds an example for this particular use case.
2016-03-26Rollup merge of #32257 - alexcrichton:fix-status-stdin, r=aturonManish Goregaokar-1/+1
std: Fix inheriting stdin on status() This regression was accidentally introduced in #31618, and it's just flipping a boolean! Closes #32254
2016-03-22try! -> ?Jorge Aparicio-1/+1
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-22Fixes test which are now run due to should_panicLukas Pustina-1/+5
Since I changed no_run to should_panic on some tests, the were run but two lacked an actual assertion. Further, I missed to check the return type on another test.
2016-03-21Adjusts all rust doc test to use `expect` and `should_panic`Lukas Pustina-14/+13
- All Rust Doc tests execute the same command `/bin/cat file.txt` which `should_panic` on all platforms consistently, because either `/bin/cat` or `file.txt` do not exist.
2016-03-19Fixes 2. stdout to stderr in rustdocLukas Pustina-1/+1
2016-03-19Revert "Tags new test as `no_run` and uses expect()"Lukas Pustina-3/+4
- After discussing with @alexcrichton, the initial commit has been fine. This reverts commit 3b5cfa3ecf4e44b251ce121ab5dcf53c35de8eea.
2016-03-18Tags new test as `no_run` and uses expect()Lukas Pustina-4/+3
2016-03-18Extends rustdoc on how to caputure outputLukas Pustina-0/+23
2016-03-14std: Fix inheriting stdin on status()Alex Crichton-1/+1
This regression was accidentally introduced in #31618, and it's just flipping a boolean! Closes #32254
2016-03-09std: Don't spawn threads in `wait_with_output`Alex Crichton-16/+20
Semantically there's actually no reason for us to spawn threads as part of the call to `wait_with_output`, and that's generally an incredibly heavyweight operation for just reading a few bytes (especially when stderr probably rarely has bytes!). An equivalent operation in terms of what's implemented today would be to just drain both pipes of all contents and then call `wait` on the child process itself. On Unix we can implement this through some convenient use of the `select` function, whereas on Windows we can make use of overlapped I/O. Note that on Windows this requires us to use named pipes instead of anonymous pipes, but they're semantically the same under the hood.
2016-03-08std: Don't always create stdin for childrenAlex Crichton-3/+4
For example if `Command::output` or `Command::status` is used then stdin is just immediately closed. Add an option for this so as an optimization we can avoid creating pipes entirely. This should help reduce the number of active file descriptors when spawning processes on Unix and the number of active handles on Windows.
2016-03-08std: Funnel read_to_end through to one locationAlex Crichton-0/+6
This pushes the implementation detail of proxying `read_to_end` through to `read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle` implementations on Unix/Windows. This way intermediate layers will also be able to take advantage of this optimized implementation. This commit also adds the optimized implementation for `ChildStdout` and `ChildStderr`.
2016-02-10std: Push process stdio setup in std::sysAlex Crichton-85/+44
Most of this is platform-specific anyway, and we generally have to jump through fewer hoops to do the equivalent operation on Windows. One benefit for Windows today is that this new structure avoids an extra `DuplicateHandle` when creating pipes. For Unix, however, the behavior should be the same. Note that this is just a pure refactoring, no functionality was added or removed.
2016-02-10std: Rename Stdio::None to Stdio::NullAlex Crichton-3/+3
This better reflects what it's actually doing as we don't actually have an option for "leave this I/O slot as an empty hole".
2016-02-10std: Push Child's exit status to sys::processAlex Crichton-44/+5
On Unix we have to be careful to not call `waitpid` twice, but we don't have to be careful on Windows due to the way process handles work there. As a result the cached `Option<ExitStatus>` is only necessary on Unix, and it's also just an implementation detail of the Unix module. At the same time. also update some code in `kill` on Unix to avoid a wonky waitpid with WNOHANG. This was added in 0e190b9a to solve #13124, but the `signal(0)` method is not supported any more so there's no need to for this workaround. I believe that this is no longer necessary as it's not really doing anything.
2016-02-10std: Implement CommandExt::before_execAlex Crichton-2/+2
This is a Unix-specific function which adds the ability to register a closure to run pre-exec to configure the child process as required (note that these closures are run post-fork). cc #31398
2016-02-10std: Refactor process spawning on UnixAlex Crichton-1/+3
* Build up the argp/envp pointers while the `Command` is being constructed rather than only when `spawn` is called. This will allow better sharing of code between fork/exec paths. * Rename `child_after_fork` to `exec` and have it only perform the exec half of the spawning. This also means the return type has changed to `io::Error` rather than `!` to represent errors that happen.
2016-02-03Auto merge of #31056 - kamalmarhubi:std-process-nul-chars, r=alexcrichtonbors-5/+51
This reports an error at the point of calling `Command::spawn()` or one of its equivalents. Fixes #30858 Fixes #30862
2016-02-03std: Properly handle interior NULs in std::processKamal Marhubi-5/+51
This reports an error at the point of calling `Command::spawn()` or one of its equivalents. Fixes https://github.com/rust-lang/rust/issues/30858 Fixes https://github.com/rust-lang/rust/issues/30862
2016-01-31Minor corrections in docs for `std::process::Child`Dirk Gadsden-4/+6
2016-01-31Safety docs about `std::process::Child` going out of scopeDirk Gadsden-0/+8
There is no `Drop` implemented for `Child`, so if it goes out of scope in Rust-land and gets deallocated, the child process will continue to exist and execute. If users want a guarantee that the process has finished running and exited they must manually use `kill`, `wait`, or `wait_with_output`. Fixes #31289.
2016-01-26Fix warnings during testsAlex Crichton-37/+25
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
2015-12-17Add a debug implementation to process::OutputEd Clarke-0/+27
2015-12-01Fix typo in src/libstd/process.rsAdam Badawy-1/+1
2015-11-23skip check for DYLD envars in child procJosh Austin-0/+1
2015-11-22test_inherit_env: Don't look for hidden environment variables on WindowsTobias Bucher-2/+4
Fixes #29972.
2015-11-17std: Use join() in Process::wait_with_outputAlex Crichton-20/+14
Previously this function used channels but this isn't necessary any more now that threads have return values. This also has the added bonus of appropriately waiting for the thread to exit to ensure that the function doesn't still have running threads once it returns.
2015-10-20Rollup merge of #29158 - arcnmx:process-test, r=alexcrichtonSteve Klabnik-1/+1
This test was mysteriously messed with as part of #28500 r? @alexcrichton
2015-10-19Correct spelling in docsAndrew Paseltiner-2/+2
2015-10-19Add missing #[test] attribute to testarcnmx-1/+1
2015-10-13Correct spelling in docsAndrew Paseltiner-1/+1
2015-09-29Tweak Travis to use GCEAlex Crichton-5/+8
Travis CI has new infrastructure using the Google Compute Engine which has both faster CPUs and more memory, and we've been encouraged to switch as it should help our build times! The only downside currently, however, is that IPv6 is disabled, causing a number of standard library tests to fail. Consequently this commit tweaks our travis config in a few ways: * ccache is disabled as it's not working on GCE just yet * Docker is used to run tests inside which reportedly will get IPv6 working * A system LLVM installation is used instead of building LLVM itself. This is primarily done to reduce build times, but we want automation for this sort of behavior anyway and we can extend this in the future with building from source as well if needed. * gcc-specific logic is removed as the docker image for Ubuntu gives us a recent-enough gcc by default.
2015-09-11std: Internalize almost all of `std::rt`Alex Crichton-1/+1
This commit does some refactoring to make almost all of the `std::rt` private. Specifically, the following items are no longer part of its API: * DEFAULT_ERROR_CODE * backtrace * unwind * args * at_exit * cleanup * heap (this is just alloc::heap) * min_stack * util The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is an entry point for the `panic!` macro via the `begin_unwind` and `begin_unwind_fmt` reexports.
2015-09-02std: Run at_exit cleanup on process::exitAlex Crichton-0/+1
This adds a call to `rt::cleanup` on `process::exit` to make sure we clean up after ourselves on the way out from Rust. Closes #28065
2015-08-04syntax: Don't assume `std` exists for testsAlex Crichton-1/+1
This commit removes the injection of `std::env::args()` from `--test` expanded code, relying on the test runner itself to call this funciton. This is more hygienic because we can't assume that `std` exists at the top layer all the time, and it meaks the injected test module entirely self contained.