Skip to content

Commit

Permalink
cmd/cue/cmd: print full error messages in tools mode
Browse files Browse the repository at this point in the history
This sometimes didn't happen.

Fixes #383

Change-Id: I0bd98165167fc2fe6b888fdec024f065d4fda6f7
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5964
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
  • Loading branch information
mpvl committed May 12, 2020
1 parent 00a8bb9 commit 5163831
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions cmd/cue/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package cmd

import (
"context"
"fmt"
"io"
"os"
"strings"
Expand Down Expand Up @@ -122,10 +121,14 @@ func MainTest() int {

// Main runs the cue tool and returns the code for passing to os.Exit.
func Main() int {
cwd, _ := os.Getwd()
err := mainErr(context.Background(), os.Args[1:])
if err != nil {
if err != ErrPrintedError {
fmt.Fprintln(os.Stderr, err)
errors.Print(os.Stderr, err, &errors.Config{
Cwd: cwd,
ToSlash: inTest,
})
}
return 1
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/cue/cmd/testdata/script/cmd_import.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
cmp stderr expect-stderr

-- expect-stderr --
command.pkg.t: reference "cli" not found
command.pkg.t: reference "cli" not found:
./task_tool.cue:6:5
-- task_tool.cue --
package home

Expand Down

0 comments on commit 5163831

Please sign in to comment.