From 2cd24ea7225f3ef8db7a7dedbc8c5da32563905b Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 17 Jan 2020 19:30:45 +0100 Subject: [PATCH] cc.v: fix C error message --- vlib/compiler/cc.v | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vlib/compiler/cc.v b/vlib/compiler/cc.v index da3c7af0a1..d210e6277c 100644 --- a/vlib/compiler/cc.v +++ b/vlib/compiler/cc.v @@ -339,13 +339,17 @@ start: println(res.output) } else { - partial_output := res.output[res.output.len-200..res.output.len].trim_right('\r\n') - print(partial_output) - if res.output.len > partial_output.len { - println('...\n(Use `v -g` to print the entire error message)\n') - } - else { - println('') + if res.output.len < 30 { + println(res.output.len) + } else { + max := 50 + n := if res.output.len > 50 { 50 } else { res.output.len } + + partial_output := res.output[res.output.len-n..].trim_right('\r\n') + print(partial_output) + if n < 50 { + println('...\n(Use `v -cg` to print the entire error message)\n') + } } } verror('C error. This should never happen. ' + '\nPlease create a GitHub issue: https://github.com/vlang/v/issues/new/choose')