os: do not trim space from output of exec

pull/5377/head
Adam Stankiewicz 2020-06-14 01:41:47 +02:00 committed by GitHub
parent 45a3d8474e
commit 471c931ada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 5 deletions

View File

@ -258,7 +258,7 @@ fn run_repl(workdir string, vrepl_prefix string) {
}
fn print_output(s os.Result) {
lines := s.output.split('\n')
lines := s.output.trim_right('\n\r').split('\n')
for line in lines {
if line.contains('.vrepl_temp.v:') {
// Hide the temporary file name

View File

@ -113,7 +113,7 @@ pub fn exec(cmd string) ?Result {
bufbp := byteptr(buf)
res.write_bytes( bufbp, vstrlen(bufbp) )
}
soutput := res.str().trim_space()
soutput := res.str()
//res.free()
exit_code := vpclose(f)
// if exit_code != 0 {

View File

@ -1,3 +1,3 @@
MyStruct {
s: '6'
}
}

View File

@ -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')
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 {

View File

@ -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}') }
content := fcontent.replace('\r', '')
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 )
@ -66,6 +66,7 @@ pub fn run_repl_file(wd string, vexec string, file string) ?string {
.replace(wd + os.path_separator, '' )
.replace(vexec_folder, '')
.replace('\\', '/')
.trim_right('\n\r')
if result != output {
file_result := '${file}.result.txt'