mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: do not trim space from output of exec
This commit is contained in:
@@ -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
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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'
|
||||
|
Reference in New Issue
Block a user