Skip to content

Commit

Permalink
feat: import upstream package (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Feb 18, 2024
1 parent 3e940e5 commit f65e936
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/UPSTREAM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3d49bd525a5d2ca9549ad8c3e138b982a6d7821e
51dec259b54f5684baebc3629a6d10ab42cd8487
12 changes: 9 additions & 3 deletions difftest/difftest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ func getDiffOutput(a, b string) (string, error) {
}
cmd := exec.Command("diff", "-u", fileA.Name(), fileB.Name())
cmd.Env = append(cmd.Env, "LANG=en_US.UTF-8")
out, err := cmd.CombinedOutput()
out, err := cmd.Output()
if err != nil {
if _, ok := err.(*exec.ExitError); !ok {
return "", fmt.Errorf("failed to run diff -u %v %v: %v\n%v", fileA.Name(), fileB.Name(), err, string(out))
exit, ok := err.(*exec.ExitError)
if !ok {
return "", fmt.Errorf("can't exec %s: %v", cmd, err)
}
if len(out) == 0 {
// Nonzero exit with no output: terminated by signal?
return "", fmt.Errorf("%s failed: %v; stderr:\n%s", cmd, err, exit.Stderr)
}
// nonzero exit + output => files differ
}
diff := string(out)
if len(diff) <= 0 {
Expand Down

0 comments on commit f65e936

Please sign in to comment.