summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖzgür Kesim <oec@codeblau.de>2024-12-09 13:40:43 +0100
committerÖzgür Kesim <oec@codeblau.de>2024-12-09 13:40:43 +0100
commit26f349fd57ce318fa74efd7f699a00d871062c48 (patch)
tree9e05f134080f1b280754f862d4514c943e5018ec
parentba4c34b5921ca3d7888e20856c0e778186fab421 (diff)
more general regex and handle stdout and stderr
-rw-r--r--uncrust.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/uncrust.go b/uncrust.go
index c08a5d9..6b8e185 100644
--- a/uncrust.go
+++ b/uncrust.go
@@ -20,7 +20,7 @@ var (
fl_lang = flag.String("l", "C", "Language")
fl_verbose = flag.Bool("v", false, "Verbosity on")
- pos_rx = regexp.MustCompile(`File: stdin, orig line is ([\d]+), orig col is ([\d])`)
+ pos_rx = regexp.MustCompile(`.* orig line is ([\d]+), orig col is ([\d])`)
)
func main() {
@@ -61,6 +61,7 @@ func main() {
if e = cmd.Run(); e != nil {
if _, ok := e.(*exec.ExitError); ok {
str := stderr.String()
+ str += "\n" + stdout.String()
if len(samfile) != 0 {
str = strings.ReplaceAll(str, "stdin, open_line is ", samfile+":")
str = pos_rx.ReplaceAllString(str, fmt.Sprintf("%s:$1:#$2", samfile))