about summary refs log tree commit diff
path: root/src/libstd/sys/unix/process/process_common.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-469/+0
2020-06-09Mark tests whcih don't work under riscv emulationTom Eccles-0/+1
2020-05-22Implement `Sync` for `process::Command on unix and vxworksLeSeulArtichaut-2/+4
2020-03-05Const items have by default a static lifetime, there's no need to annotate ↵Matthias Krüger-2/+2
it. (clippy::redundant_static_lifetimes)
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-3/+1
example: let s: String = format!("hello").into();
2019-12-16Fix up Command Debug output when arg0 is specified.Jeremy Fitzhardinge-2/+6
PR https://github.com/rust-lang/rust/pull/66512 added the ability to set argv[0] on Command. As a side effect, it changed the Debug output to print both the program and argv[0], which in practice results in stuttery output ("echo echo foo"). This PR reverts the behaviour to the the old one, so that the command is only printed once - unless arg0 has been set. In that case it emits "[command] arg0 arg1 ...".
2019-11-29Format libstd/sys with rustfmtDavid Tolnay-42/+22
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd/sys *that are not involved in any currently open PR* to minimize merge conflicts. THe list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in outstanding_files, the relevant commands were: $ find src/libstd/sys -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd/sys outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of the files. To confirm no funny business: $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference
2019-11-19Add unix::process::CommandExt::arg0Jeremy Fitzhardinge-7/+16
This allows argv[0] to be overridden on the executable's command-line. This also makes the program executed independent of argv[0]. Does Fuchsia have the same semantics? Addresses: #66510
2019-09-25Fix ExitStatus on FuchsiaTyler Mandry-51/+0
Fuchsia exit codes don't follow the convention of libc::WEXITSTATUS et al, and they are 64 bits instead of 32 bits. This gives Fuchsia its own representation of ExitStatus. Additionally, the zircon syscall structs were out of date, causing us to see bogus return codes.
2019-09-07Rollup merge of #64023 - tmandry:libstd-fuchsia-fixes, r=cramertjMazdak Farrokhzad-3/+25
libstd fuchsia fixes This fixes two bugs in libstd on Fuchsia: - `zx_time_t` was changed to an `i64`, but this never made it into libstd - When spawning processes where any of the stdio were null, libstd attempts to open `/dev/null`, which doesn't exist on Fuchsia r? @cramertj
2019-09-05std: Improve downstream codegen in `Command::env`Alex Crichton-4/+4
This commit rejiggers the generics used in the implementation of `Command::env` with the purpose of reducing the amount of codegen that needs to happen in consumer crates, instead preferring to generate code into libstd. This was found when profiling the compile times of the `cc` crate where the binary rlib produced had a lot of `BTreeMap` code compiled into it but the crate doesn't actually use `BTreeMap`. It turns out that `Command::env` is generic enough to codegen the entire implementation in calling crates, but in this case there's no performance concern so it's fine to compile the code into the standard library. This change is done by removing the generic on the `CommandEnv` map which is intended to handle case-insensitive variables on Windows. Instead now a generic isn't used but rather a `use` statement defined per-platform is used. With this commit a debug build of `Command::new("foo").env("a", "b")` drops from 21k lines of LLVM IR to 10k.
2019-08-30Don't try to use /dev/null on FuchsiaTyler Mandry-3/+25
2019-08-19Consolidate sigemptyset workaroundsJoe Richey-30/+24
In sys/unix/process, we work around the sigemptyset linking issues on android in two different ways. This change consolidates these workarounds, and avoids duplicating bindings from `libc`.
2019-08-06Fix cfg_if usageJeremy Soller-1/+1
2019-08-06redox: convert to target_family unixJeremy Soller-1/+9
2019-06-26Use pointer::write_bytes for android sigemptysetJosh Stone-1/+1
2019-06-26Avoid mem::uninitialized() in std::sys::unixJosh Stone-6/+6
For `libc` types that will be initialized in FFI calls, we can just use `MaybeUninit` and then pass around raw pointers. For `sun_path_offset()`, which really wants `offset_of`, all callers have a real `sockaddr_un` available, so we can use that reference.
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-2/+2
2019-02-28libstd => 2018Taiki Endo-18/+18
2019-02-03more formattingRalf Jung-2/+4
2019-02-01deprecate before_exec in favor of unsafe pre_execRalf Jung-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-11-14Revert "Fixes #46775 -- don't mutate the process's environment in Command::exec"Alex Crichton-8/+0
This reverts commit 36fe3b605a7a7143a14565272140ba1b43c1b041.
2018-11-01Fixes #46775 -- don't mutate the process's environment in Command::execAlex Gaynor-0/+8
Instead, pass the environment to execvpe, so the kernel can apply it directly to the new process. This avoids a use-after-free in the case where exec'ing the new process fails for any reason, as well as a race condition if there are other threads alive during the exec.
2018-07-10Add missing `dyn` for cloudabi, redox, unix and wasmljedrz-3/+3
2018-04-05std: Inline some Termination-related methodsAlex Crichton-0/+1
These were showing up in tests and in binaries but are trivially optimize-able away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them out.
2018-03-22Command::env_saw_path() may be unused on platforms not using posix_spawn()Bryan Drewery-0/+1
2018-03-19Don't use posix_spawn() if PATH was modified in the environment.Bryan Drewery-0/+3
The expected behavior is that the environment's PATH should be used to find the process. posix_spawn() could be used if we iterated PATH to search for the binary to execute. For now just skip posix_spawn() if PATH is modified.
2018-03-03Move process::ExitCode internals to sysScott McMurray-1/+13
Now begins the saga of fixing compilation errors on other platforms...
2018-01-26make Command.argv Send on unix platformsCorentin Henry-10/+11
Implementing Send for a specific field rather than the whole struct is safer: if a field is changed/modified and becomes non-Send, we can catch it.
2018-01-25implement Send for process::Command on unixCorentin Henry-0/+5
closes https://github.com/rust-lang/rust/issues/47751
2017-12-24Capture environment at spawnDiggory Blake-83/+60
2017-10-05Remove nacl from libstdest31-1/+0
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-07-24Add a disabled builder for aarch64 emulated testsAlex Crichton-0/+1
This commit adds a disabled builder which will run all tests for the standard library for aarch64 in a QEMU instance. Once we get enough capacity to run this on Travis this can be used to boost our platform coverage of AArch64
2017-06-06Add conversions from File and Child* handles to StdioJosh Stone-0/+12
`Stdio` now implements `From<ChildStdin>`, `From<ChildStdout>`, `From<ChildStderr>`, and `From<File>`. The `Command::stdin`/`stdout`/`stderr` methods now take any type that implements `Into<Stdio>`. This makes it much easier to write shell-like command chains, piping to one another and redirecting to and from files. Otherwise one would need to use the unsafe and OS-specific `from_raw_fd` or `from_raw_handle`.
2017-03-25Avoid using libc::sigemptyset on AndroidMarco A L Barbosa-1/+15
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-2/+2
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-01-29Add support for test suites emulated in QEMUAlex Crichton-1/+5
This commit adds support to the build system to execute test suites that cannot run natively but can instead run inside of a QEMU emulator. A proof-of-concept builder was added for the `arm-unknown-linux-gnueabihf` target to show off how this might work. In general the architecture is to have a server running inside of the emulator which a local client connects to. The protocol between the server/client supports compiling tests on the host and running them on the target inside the emulator. Closes #33114
2016-12-01std::process fuchsia support cleanupTheodore DeRego-3/+3
2016-11-23Separated fuchsia-specific process stuff into 'process_fuchsia.rs' and ↵Theodore DeRego-0/+480
refactored out some now-duplicated code into a 'process_common.rs'