Commit 665eaa52 authored by Jeremy Soller's avatar Jeremy Soller

Allow init to change stdio

parent 385df792
[package]
name = "init"
version = "0.1.0"
[dependencies]
syscall = { path = "../../syscall" }
extern crate syscall;
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
......@@ -50,6 +52,17 @@ pub fn run(file: &str) -> Result<()> {
} else {
println!("init: failed to run: no argument");
},
"stdio" => if let Some(stdio) = args.next() {
let _ = syscall::close(2);
let _ = syscall::close(1);
let _ = syscall::close(0);
let _ = syscall::open(&stdio, syscall::flag::O_RDWR);
let _ = syscall::open(&stdio, syscall::flag::O_RDWR);
let _ = syscall::open(&stdio, syscall::flag::O_RDWR);
} else {
println!("init: failed to set stdio: no argument");
},
_ => {
let mut command = Command::new(cmd);
for arg in args {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment