Skip to content

Commit 7fa1a89

Browse files
authored
Make diff flag check work for GNU diffutils 3.3 (#99)
It seems that some point after GNU diffutils 2.8.1 the output changed from using a backtick to a single quote. That's why the check fails even if the diff version supports it.
1 parent 36c0cf2 commit 7fa1a89

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cmd/src/actions_exec_backend_runner.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"os/exec"
1414
"path"
1515
"path/filepath"
16+
"regexp"
1617
"strings"
1718
"time"
1819

@@ -280,7 +281,10 @@ func diffSupportsFlag(ctx context.Context, flag string) (bool, error) {
280281
if err != nil && cmd.ProcessState.ExitCode() != 2 {
281282
return false, errors.Wrapf(err, "Checking whether diff supports %q failed", flag)
282283
}
283-
return !strings.Contains(string(out), "unrecognized option `"+flag), nil
284+
285+
pattern := fmt.Sprintf("unrecognized\\soption\\s[`']%s", flag)
286+
matched, err := regexp.MatchString(pattern, string(out))
287+
return !matched, err
284288
}
285289

286290
// We use an explicit prefix for our temp directories, because otherwise Go

0 commit comments

Comments
 (0)