os: do not trim space from output of exec
parent
45a3d8474e
commit
471c931ada
|
@ -258,7 +258,7 @@ fn run_repl(workdir string, vrepl_prefix string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_output(s os.Result) {
|
fn print_output(s os.Result) {
|
||||||
lines := s.output.split('\n')
|
lines := s.output.trim_right('\n\r').split('\n')
|
||||||
for line in lines {
|
for line in lines {
|
||||||
if line.contains('.vrepl_temp.v:') {
|
if line.contains('.vrepl_temp.v:') {
|
||||||
// Hide the temporary file name
|
// Hide the temporary file name
|
||||||
|
|
|
@ -113,7 +113,7 @@ pub fn exec(cmd string) ?Result {
|
||||||
bufbp := byteptr(buf)
|
bufbp := byteptr(buf)
|
||||||
res.write_bytes( bufbp, vstrlen(bufbp) )
|
res.write_bytes( bufbp, vstrlen(bufbp) )
|
||||||
}
|
}
|
||||||
soutput := res.str().trim_space()
|
soutput := res.str()
|
||||||
//res.free()
|
//res.free()
|
||||||
exit_code := vpclose(f)
|
exit_code := vpclose(f)
|
||||||
// if exit_code != 0 {
|
// if exit_code != 0 {
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn test_the_v_compiler_can_be_invoked() {
|
||||||
}
|
}
|
||||||
// println('"$vcmd_error" exit_code: $r_error.exit_code | output: $r_error.output')
|
// println('"$vcmd_error" exit_code: $r_error.exit_code | output: $r_error.output')
|
||||||
assert r_error.exit_code == 1
|
assert r_error.exit_code == 1
|
||||||
assert r_error.output == "builder error: nonexisting.v doesn't exist"
|
assert r_error.output.trim_space() == "builder error: nonexisting.v doesn't exist"
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Session {
|
struct Session {
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub fn run_repl_file(wd string, vexec string, file string) ?string {
|
||||||
fcontent := os.read_file(file) or { return error('Could not read file ${file}') }
|
fcontent := os.read_file(file) or { return error('Could not read file ${file}') }
|
||||||
content := fcontent.replace('\r', '')
|
content := fcontent.replace('\r', '')
|
||||||
input := content.all_before('===output===\n')
|
input := content.all_before('===output===\n')
|
||||||
output := content.all_after('===output===\n')
|
output := content.all_after('===output===\n').trim_right('\n\r')
|
||||||
|
|
||||||
fname := os.file_name( file )
|
fname := os.file_name( file )
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ pub fn run_repl_file(wd string, vexec string, file string) ?string {
|
||||||
.replace(wd + os.path_separator, '' )
|
.replace(wd + os.path_separator, '' )
|
||||||
.replace(vexec_folder, '')
|
.replace(vexec_folder, '')
|
||||||
.replace('\\', '/')
|
.replace('\\', '/')
|
||||||
|
.trim_right('\n\r')
|
||||||
|
|
||||||
if result != output {
|
if result != output {
|
||||||
file_result := '${file}.result.txt'
|
file_result := '${file}.result.txt'
|
||||||
|
|
Loading…
Reference in New Issue