File: exec.rs

package info (click to toggle)
rust-exec 0.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 128 kB
  • sloc: makefile: 4
file content (18 lines) | stat: -rw-r--r-- 489 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
extern crate exec;

use std::env;
use std::process;

fn main() {
    let argv: Vec<String> = env::args().skip(1).collect();
    if argv.len() < 1 {
        println!("Must specify command to execute");
        process::exit(1);
    }

    // Exec the specified program.  If all goes well, this will never
    // return.  If it does return, it will always retun an error.
    let err = exec::Command::new(&argv[0]).args(&argv).exec();
    println!("Error: {}", err);
    process::exit(1);
}