Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f45fe94
Add license metadata for std dependencies
clehner Feb 20, 2021
2cbea9f
Reuse `std::sys::unsupported::pipe` on `hermit`
CDirkx Feb 24, 2021
8c718bd
Attempt to gather similar stats as rusage on Windows
rylev Mar 4, 2021
0201e2b
Add more windows specific numbers
rylev Mar 5, 2021
a2571cf
Implement String::remove_matches
jcotton42 Mar 5, 2021
302867c
Clean up handling of child process
rylev Mar 11, 2021
5e788f2
Add Linux-specific pidfd process extensions
Aaron1011 Sep 16, 2020
3426bf7
Typo fix
joshtriplett Oct 18, 2020
704d6c5
Add PidFd type and seal traits
voidc Feb 6, 2021
766cc25
Add tracking issue and link to man-page
voidc Mar 10, 2021
d850f6b
Update libc dependency to 0.2.89
voidc Mar 15, 2021
5ac8a31
Fix test header and imports
voidc Mar 16, 2021
a266bd8
Split do_fork into two
voidc Mar 16, 2021
cfb2d72
Make do_fork unsafe
voidc Mar 16, 2021
620ecc0
Move some test-only code to test files
jyn514 Mar 17, 2021
b1de9d4
Fix gitattibutes for old git versions
Mar 16, 2021
cfb4ad4
Remove unwrap_none/expect_none from compiler/.
m-ou-se Mar 4, 2021
390d1ef
Extend `proc_macro_back_compat` lint to `actix-web`
Aaron1011 Mar 16, 2021
99b2054
Fix typo/inaccuracy in the documentation of Iterator::skip_while
steffahn Mar 18, 2021
9dfda62
Clarify docs for Read::read's return value
jix Mar 8, 2021
e1fd230
Rollup merge of #71780 - jcotton42:string_remove_matches, r=joshtriplett
Dylan-DPC Mar 18, 2021
fe230b1
Rollup merge of #81825 - voidc:pidfd, r=joshtriplett
Dylan-DPC Mar 18, 2021
b0ac545
Rollup merge of #82374 - clehner:licenses, r=joshtriplett
Dylan-DPC Mar 18, 2021
4c3abdc
Rollup merge of #82500 - CDirkx:hermit-pipe, r=joshtriplett
Dylan-DPC Mar 18, 2021
6417d4d
Rollup merge of #82754 - rylev:rusage-windows, r=pnkfelix
Dylan-DPC Mar 18, 2021
05984bc
Rollup merge of #82759 - m-ou-se:remove-unwrap-none, r=petrochenkov
Dylan-DPC Mar 18, 2021
0f15079
Rollup merge of #82892 - jix:clarify-read-read, r=joshtriplett
Dylan-DPC Mar 18, 2021
3f4b7ec
Rollup merge of #83179 - Aaron1011:actix-web-lint, r=petrochenkov
Dylan-DPC Mar 18, 2021
8dbc59d
Rollup merge of #83197 - jyn514:cfg-test-dead-code, r=joshtriplett
Dylan-DPC Mar 18, 2021
d12cfc9
Rollup merge of #83208 - jethrogb:jb/gitignore, r=Xanewok
Dylan-DPC Mar 18, 2021
d97769e
Rollup merge of #83270 - steffahn:missing_word_in_skip_while_doc, r=j…
Dylan-DPC Mar 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up handling of child process
  • Loading branch information
rylev committed Mar 11, 2021
commit 302867cf48db284cc666fff7c2953f6f94f30aac
28 changes: 9 additions & 19 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use std::env;
use std::path::PathBuf;
use std::process::Command;
use std::process::{Child, Command};
use std::str::FromStr;
use std::time::Instant;

Expand Down Expand Up @@ -171,19 +171,8 @@ fn main() {
let is_test = args.iter().any(|a| a == "--test");
// If the user requested resource usage data, then
// include that in addition to the timing output.
let rusage_data = env::var_os("RUSTC_PRINT_STEP_RUSAGE").and_then(|_| {
#[cfg(windows)]
{
use std::os::windows::io::AsRawHandle;
let handle = child.as_raw_handle();
format_rusage_data(handle)
}
#[cfg(not(windows))]
{
let _child = child;
format_rusage_data()
}
});
let rusage_data =
env::var_os("RUSTC_PRINT_STEP_RUSAGE").and_then(|_| format_rusage_data(child));
eprintln!(
"[RUSTC-TIMING] {} test:{} {}.{:03}{}{}",
crate_name,
Expand Down Expand Up @@ -221,15 +210,16 @@ fn main() {
}

#[cfg(all(not(unix), not(windows)))]
/// getrusage is not available on non-unix platforms. So for now, we do not
/// bother trying to make a shim for it.
fn format_rusage_data() -> Option<String> {
// In the future we can add this for more platforms
fn format_rusage_data(_child: Child) -> Option<String> {
None
}

#[cfg(windows)]
fn format_rusage_data(handle: std::os::windows::raw::HANDLE) -> Option<String> {
fn format_rusage_data(child: Child) -> Option<String> {
use std::os::windows::io::AsRawHandle;
use winapi::um::{processthreadsapi, psapi, timezoneapi};
let handle = child.as_raw_handle();
macro_rules! try_bool {
($e:expr) => {
if $e != 1 {
Expand Down Expand Up @@ -295,7 +285,7 @@ fn format_rusage_data(handle: std::os::windows::raw::HANDLE) -> Option<String> {
/// fields. Note that we are focusing mainly on data that we believe to be
/// supplied on Linux (the `rusage` struct has other fields in it but they are
/// currently unsupported by Linux).
fn format_rusage_data() -> Option<String> {
fn format_rusage_data(_child: Child) -> Option<String> {
let rusage: libc::rusage = unsafe {
let mut recv = std::mem::zeroed();
// -1 is RUSAGE_CHILDREN, which means to get the rusage for all children
Expand Down