Skip to content

Commit d57aaae

Browse files
committed
auto merge of #5863 : huonw/rust/rust-run-args, r=thestinger
e.g. ``` $ cat echo.rs fn main() { io::println(fmt!("%?", os::args())); } $ rust run echo.rs 1 2 3 ~[~"./echo~", ~"1", ~"2", ~"3"] ```
2 parents 65ff441 + d70f0f1 commit d57aaae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librust/rust.rc

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ static commands: &'static [Command<'static>] = &[
6767
usage_line: "build an executable, and run it",
6868
usage_full: UsgStr(
6969
"The run command is an shortcut for the command line \n\
70-
\"rustc <filename> -o <filestem>~ && ./<filestem>~\".\
71-
\n\nUsage:\trust run <filename>"
70+
\"rustc <filename> -o <filestem>~ && ./<filestem>~ [<arguments>...]\".\
71+
\n\nUsage:\trust run <filename> [<arguments>...]"
7272
)
7373
},
7474
Command{
@@ -169,14 +169,14 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
169169

170170
fn cmd_run(args: &[~str]) -> ValidUsage {
171171
match args {
172-
[filename] => {
172+
[filename, ..prog_args] => {
173173
let exec = Path(filename).filestem().unwrap() + "~";
174174
if run::run_program("rustc", [
175175
filename.to_owned(),
176176
~"-o",
177177
exec.to_owned()
178178
]) == 0 {
179-
run::run_program(~"./"+exec, []);
179+
run::run_program(~"./"+exec, prog_args);
180180
}
181181
Valid
182182
}

0 commit comments

Comments
 (0)