summary refs log tree commit diff
path: root/src/libstd/io/process.rs
AgeCommit message (Collapse)AuthorLines
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-28native: Use WNOHANG before signalingAlex Crichton-3/+26
It turns out that on linux, and possibly other platforms, child processes will continue to accept signals until they have been *reaped*. This means that once the child has exited, it will succeed to receive signals until waitpid() has been invoked on it. This is unfortunate behavior, and differs from what is seen on OSX and windows. This commit changes the behavior of Process::signal() to be the same across platforms, and updates the documentation of Process::kill() to note that when signaling a foreign process it may accept signals until reaped. Implementation-wise, this invokes waitpid() with WNOHANG before each signal to the child to ensure that if the child has exited that we will reap it. Other possibilities include installing a SIGCHLD signal handler, but at this time I believe that that's too complicated. Closes #13124
2014-03-27Fix fallout of removing default boundsAlex Crichton-1/+1
This is all purely fallout of getting the previous commit to compile.
2014-03-20std: Implement Clone/TotalEq for ProcessExitAlex Crichton-1/+2
It's useful for structures which use deriving(Clone, TotalEq), even though it's implicitly copyable. Closes #13047
2014-03-13std: Rename Chan/Port types and constructorAlex Crichton-5/+5
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
2014-02-24windows: Fix the test_exists unit testAlex Crichton-2/+5
Turns out the `timeout` command was exiting immediately because it didn't like its output piped. Instead use `ping` repeatedly to get a process that will sleep for awhile. cc #12516
2014-02-24Correctly ignore some tests on windowsAlex Crichton-2/+1
These two tests are notoriously flaky on the windows bots right now, so I'm ignoring them until I can investigate them some more. The truncate_works test has been flaky for quite some time, but it has gotten much worse recently. The test_exists test has been flaky since the recent std::run rewrite landed. Finally, the "unix pipe" test failure is a recent discovery on the try bots. I haven't seen this failing much, but better safe than sorry! cc #12516
2014-02-23Roll std::run into std::io::processAlex Crichton-78/+519
The std::run module is a relic from a standard library long since past, and there's not much use to having two modules to execute processes with where one is slightly more convenient. This commit merges the two modules, moving lots of functionality from std::run into std::io::process and then deleting std::run. New things you can find in std::io::process are: * Process::new() now only takes prog/args * Process::configure() takes a ProcessConfig * Process::status() is the same as run::process_status * Process::output() is the same as run::process_output * I/O for spawned tasks is now defaulted to captured in pipes instead of ignored * Process::kill() was added (plus an associated green/native implementation) * Process::wait_with_output() is the same as the old finish_with_output() * destroy() is now signal_exit() * force_destroy() is now signal_kill() Closes #2625 Closes #10016
2014-02-16Allow configuration of uid/gid/detach on processesAlex Crichton-23/+106
This just copies the libuv implementation for libnative which seems reasonable enough (uid/gid fail on windows). Closes #12082
2014-02-08std::fmt: convert the formatting traits to a proper self.Huon Wilson-2/+2
Poly and String have polymorphic `impl`s and so require different method names.
2014-02-03std: Fixing all documentationAlex Crichton-1/+1
* Stop referencing io_error * Start changing "Failure" sections to "Error" sections * Update all doc examples to work.
2014-02-03std: Fix tests with io_error usageAlex Crichton-17/+8
2014-02-03std: Remove io::io_errorAlex Crichton-10/+5
* All I/O now returns IoResult<T> = Result<T, IoError> * All formatting traits now return fmt::Result = IoResult<()> * The if_ok!() macro was added to libstd
2014-02-02std: rename fmt::Default to `Show`.Huon Wilson-1/+1
This is a better name with which to have a #[deriving] mode. Decision in: https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-01-28
2014-01-21[std::str] Rename from_utf8_opt() to from_utf8(), drop the old from_utf8() ↵Simon Sapin-1/+1
behavior
2014-01-21[std::vec] Rename .pop_opt() to .pop(), drop the old .pop() behaviorSimon Sapin-2/+5
2014-01-15Issue #3511 - Rationalize temporary lifetimes.Niko Matsakis-7/+7
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way.
2013-12-27Bring native process bindings up to dateAlex Crichton-2/+149
Move the tests into libstd, use the `iotest!` macro to test both native and uv bindings, and use the cloexec trick to figure out when the child process fails in exec.
2013-12-24std: Expose that LocalIo may not always be availableAlex Crichton-13/+11
It is not the case that all programs will always be able to acquire an instance of the LocalIo borrow, so this commit exposes this limitation by returning Option<LocalIo> from LocalIo::borrow(). At the same time, a helper method LocalIo::maybe_raise() has been added in order to encapsulate the functionality of raising on io_error if there is on local I/O available.
2013-12-11Make 'self lifetime illegal.Erik Price-6/+6
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-10librustuv: Change `with_local_io` to use RAII.Patrick Walton-16/+13
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-2/+2
2013-11-14test: Fix signal-exit-status on windowsklutzy-0/+1
2013-11-11Move std::rt::io to std::ioAlex Crichton-0/+177