Skip to content

Commit d70f0f1

Browse files
committed
librust: make rust run file.rs past any extra arguments to the compiled program.
1 parent 65ff441 commit d70f0f1

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)