From f0e6a1c1c1302a4a540e2bb7c43d1c197c13c50d Mon Sep 17 00:00:00 2001
From: Henrixounez <henrix.ounez@yahoo.fr>
Date: Wed, 26 Jun 2019 14:13:02 +0200
Subject: [PATCH] added arguments handling for run

---
 compiler/main.v | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compiler/main.v b/compiler/main.v
index f87eb20a0d..e8352b3a24 100644
--- a/compiler/main.v
+++ b/compiler/main.v
@@ -380,12 +380,15 @@ string _STR_TMP(const char *fmt, ...) {
 		if true || c.is_verbose {
 			println('============running $c.out_name==============================')
 		}
-		cmd := if c.out_name.starts_with('/') {
+		mut cmd := if c.out_name.starts_with('/') {
 			c.out_name
 		}
 		else {
 			'./' + c.out_name
 		}
+		if os.args.len > 3 {
+			cmd += ' ' + os.args.right(3).join(' ')
+		}
 		ret := os.system2(cmd)
 		if ret != 0 {
 			s := os.system(cmd)
@@ -687,6 +690,9 @@ fn (c &V) log(s string) {
 
 fn new_v(args[]string) *V {
 	mut dir := args.last()
+	if args.contains('run') {
+		dir = args[2]
+	}
 	// println('new compiler "$dir"')
 	if args.len < 2 {
 		dir = ''