From b7361d00aa0ccc999cd13094c8d8b17497268842 Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sat, 7 Sep 2019 02:30:55 +1000 Subject: [PATCH] compiler: fix v test v on paths with spaces --- compiler/cc.v | 9 +++++---- compiler/main.v | 8 ++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/compiler/cc.v b/compiler/cc.v index 25f4e31db8..ffd6a2166f 100644 --- a/compiler/cc.v +++ b/compiler/cc.v @@ -85,14 +85,14 @@ fn (v mut V) cc() { } // -I flags /* -mut args := '' + mut args := '' for flag in v.get_os_cflags() { if !flag.starts_with('-l') { - args += flag + args += flag.value args += ' ' } } -*/ + */ if v.pref.sanitize { a << '-fsanitize=leak' } @@ -111,7 +111,7 @@ mut args := '' // Cross compiling windows // // Output executable name - a << '-o $v.out_name' + a << '-o "$v.out_name"' if os.dir_exists(v.out_name) { cerror('\'$v.out_name\' is a directory') } @@ -127,6 +127,7 @@ mut args := '' if v.os == .mac { a << '-mmacosx-version-min=10.7' } + // add all flags for flag in v.get_os_cflags() { a << flag.format() } diff --git a/compiler/main.v b/compiler/main.v index 07d0ac6924..0ec415a42b 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -942,7 +942,9 @@ fn test_v() { file := os.realpath( relative_file ) tmpcfilepath := file.replace('_test.v', '_test.tmp.c') print(relative_file + ' ') - r := os.exec('$vexe $joined_args -debug $file') or { + mut cmd := '"$vexe" $joined_args -debug "$file"' + if os.user_os() == 'windows' { cmd = '"$cmd"' } + r := os.exec(cmd) or { failed = true println('FAIL') continue @@ -961,7 +963,9 @@ fn test_v() { file := os.realpath( relative_file ) tmpcfilepath := file.replace('.v', '.tmp.c') print(relative_file + ' ') - r := os.exec('$vexe $joined_args -debug $file') or { + mut cmd := '"$vexe" $joined_args -debug "$file"' + if os.user_os() == 'windows' { cmd = '"$cmd"' } + r := os.exec(cmd) or { failed = true println('FAIL') continue