Chris Denton
c43210f67b
Pass on null handle values to child process
2022-10-24 02:34:48 +01:00
joboet
2d2c9e4493
std: use sync::Mutex
for internal statics
2022-10-13 12:55:14 +02:00
Aron Parker
0503bc0149
Implement ExitCodeExt for Windows
2022-06-09 15:32:01 +02:00
Mark Rousskov
6259670d50
Revert "Auto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-se"
...
This reverts commit ddb7fbe843
, reversing
changes made to baaa3b6829
.
2022-05-17 18:46:11 -04:00
Yuki Okushi
7274447c36
Rollup merge of #96861 - m-ou-se:std-use-prelude-2021, r=joshtriplett
...
Use Rust 2021 prelude in std itself.
2022-05-11 00:09:34 +09:00
unknown
5368ea7d2e
Expose process main_thread_handle on Windows
2022-05-10 02:41:19 -03:00
Mara Bos
4f212f08cf
Use Rust 2021 prelude in std itself.
2022-05-09 11:12:32 +02:00
Chris Denton
1e7c15634d
Note the importance of using sync pipes
2022-04-27 13:56:59 +01:00
Chris Denton
949b978ec9
Windows: Make stdin pipes synchronous
...
Stdin pipes do not need to be used asynchronously within the standard library.
2022-04-26 16:31:27 +01:00
bors
756ffb8d0b
Auto merge of #95246 - ChrisDenton:command-args, r=joshtriplett
...
Windows Command: Don't run batch files using verbatim paths
Fixes #95178
Note that the first commit does some minor refactoring (moving command line argument building to args.rs). The actual changes are in the second.
2022-04-25 07:28:09 +00:00
Chris Denton
90130549f4
Windows: Use a pipe relay for chaining pipes
2022-04-08 11:35:29 +01:00
Chris Denton
23320a2f83
Command: handle exe and batch files separately
2022-03-23 05:33:43 +00:00
Chris Denton
d59cf5629e
Refactor: Move argument building into args
2022-03-23 04:18:47 +00:00
Chris Denton
93f627daa5
Keep the path after program_exists
succeeds
2022-02-17 13:17:19 +00:00
Chris Denton
d4686c6066
Use verbatim paths for process::Command
if necessary
2022-02-17 13:12:49 +00:00
Chris Denton
9a7a8b9255
Maintain broken symlink behaviour for the Windows exe resolver
2022-02-14 12:50:18 +00:00
Yuki Okushi
ec2fd8a35f
Rollup merge of #93445 - yaahc:exitcode-constructor, r=dtolnay
...
Add From<u8> for ExitCode
This should cover a mostly cross-platform subset of supported exit codes.
We decided to stick with `u8` initially since its the common subset between all platforms that we support (excluding wasm which I think only works with `true` or `false`). Posix is supposed to take i32s, but in practice many unix platforms mask out all but the low 8 bits or in some cases the 8-15th bits. Windows takes a u32 instead of an i32. Bourne-compatible shells also report signals as exitcode 128 + `signal_no`, so there's some ambiguity there when returning exit codes > 127, but it is possible to disambiguate them on the other side so we decided against restricting the possible codes further than to `u8`.
## Related
- Detailed analysis of exit code support on various platforms: https://internals.rust-lang.org/t/mini-pre-rfc-redesigning-process-exitstatus/5426
- https://github.com/rust-lang/rust/issues/48711
- https://github.com/rust-lang/rust/issues/43301
- https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Termination.2FExit.20Status.20Stabilization
2022-02-09 14:12:17 +09:00
Jane Lusby
cf4ac6b1e1
Add From<u8> for ExitCode
...
This should cover a mostly cross-platform subset of supported exit codes.
2022-02-06 12:43:12 -08:00
Thom Chiovoloni
554918e311
Hide Repr details from io::Error, and rework io::Error::new_const
.
2022-02-04 18:47:29 -08:00
Chris Denton
4145877731
Explicitly pass PATH
to the Windows exe resolver
2022-01-03 12:55:42 +00:00
Chris Denton
de764a7ccb
Quote bat script command line
2021-12-16 17:22:32 +00:00
Chris Denton
d9a1f9a79c
Windows: Resolve Command program without using the current directory
2021-10-31 16:32:34 +00:00
Dan Gohman
6f872880b4
Use the correct into_*
on Windows to avoid dropping a stdio handle.
...
Use `into_raw_handle()` rather than `into_inner()` to completely consume a
`Handle` without dropping its contained handle.
2021-08-19 12:02:41 -07:00
Dan Gohman
d15418586c
I/O safety.
...
Introduce `OwnedFd` and `BorrowedFd`, and the `AsFd` trait, and
implementations of `AsFd`, `From<OwnedFd>` and `From<T> for OwnedFd`
for relevant types, along with Windows counterparts for handles and
sockets.
Tracking issue:
- <https://github.com/rust-lang/rust/issues/87074 >
RFC:
- <https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md >
2021-08-19 12:02:39 -07:00
Chris Denton
419902e413
Fix Windows Command::env("PATH")
2021-08-08 16:03:39 +01:00
Kornel
bc67f6bc95
Debug formatting of raw_arg()
2021-07-09 14:24:34 +01:00
Kornel
d868da7796
Unescaped command-line arguments for Windows
...
Fixes #29494
2021-07-09 14:09:48 +01:00
bors
1540711946
Auto merge of #85270 - ChrisDenton:win-env-case, r=m-ou-se
...
When using `process::Command` on Windows, environment variable names must be case-preserving but case-insensitive
When using `Command` to set the environment variables, the key should be compared as uppercase Unicode but when set it should preserve the original case.
Fixes #85242
2021-07-04 01:24:05 +00:00
bors
481971978f
Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkov
...
Use HTTPS links where possible
While looking at #86583 , I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS.
Notes:
- I didn't change any to or in licences
- Some links don't support HTTPS :(
- Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-26 08:24:31 +00:00
Smitty
bdfcb88e8b
Use HTTPS links where possible
2021-06-23 16:26:46 -04:00
Chris Denton
365a3586a9
Windows: Fix Command::env_clear
so it works
...
Previously, it would error unless at least one new environment variable was added.
2021-06-19 09:46:34 +01:00
Chris Denton
a200c01e4f
Document how Windows compares environment variables
2021-06-17 07:15:33 +01:00
Chris Denton
8345538fec
Windows Command
environment variables are case-preserving
...
But comparing is case-insensitive.
2021-05-19 23:34:15 +01:00
Ian Jackson
e893089ea0
Provide ExitStatusError
...
Closes #73125
This is in pursuance of
Issue #73127 Consider adding #[must_use] to std::process::ExitStatus
In
MR #81452 Add #[must_use] to [...] process::ExitStatus
we concluded that the existing arrangements in are too awkward
so adding that #[must_use] is blocked on improving the ergonomics.
I wrote a mini-RFC-style discusion of the approach in
https://github.com/rust-lang/rust/issues/73125#issuecomment-771092741
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-12 11:12:19 +01:00
Christiaan Dirkx
1ac632627b
Remove DropGuard
in sys::windows::process
and use StaticMutex
instead
2021-04-28 19:11:57 +02:00
Mara Bos
7b71719faf
Use io::Error::new_const everywhere to avoid allocations.
2021-03-21 20:22:38 +01:00
Yonggang Luo
fa23ddf6e6
Expose force_quotes on Windows.
...
Quotes the arg and not quotes the arg have different effect on Windows when the program called
are msys2/cygwin program.
Refer to https://github.com/msys2/MSYS2-packages/issues/2176
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
2021-02-17 17:54:04 +00:00
Eric Huss
c297e20e03
Add accessors to Command.
2020-09-26 18:58:38 -07:00
Lzu Tao
a4e926daee
std: move "mod tests/benches" to separate files
...
Also doing fmt inplace as requested.
2020-08-31 02:56:59 +00:00
mark
2c31b45ae8
mv std libs to library/
2020-07-27 19:51:13 -05:00