mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	 635a06b595
			
		
	
	
		635a06b595
		
	
	
	
	
		
			
			- Remove unnecessary `#![allow(unused_imports)]`. - Replace `ignore-*` with `needs-subprocess`.
		
			
				
	
	
		
			25 lines
		
	
	
		
			475 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			475 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ run-pass
 | |
| //@ needs-subprocess
 | |
| 
 | |
| use std::env;
 | |
| use std::process::{self, Command};
 | |
| 
 | |
| fn main() {
 | |
|     let args: Vec<String> = env::args().collect();
 | |
|     if args.len() > 1 && args[1] == "child" {
 | |
|         child();
 | |
|     } else {
 | |
|         parent();
 | |
|     }
 | |
| }
 | |
| 
 | |
| fn parent() {
 | |
|     let args: Vec<String> = env::args().collect();
 | |
|     let status = Command::new(&args[0]).arg("child").status().unwrap();
 | |
|     assert_eq!(status.code(), Some(2));
 | |
| }
 | |
| 
 | |
| fn child() -> i32 {
 | |
|     process::exit(2);
 | |
| }
 |