Skip to content

Commit

Permalink
v.util.diff: support OpenBSD's default diff tool (#20369)
Browse files Browse the repository at this point in the history
Co-authored-by: user <user@vegasbaby.localdomain>
  • Loading branch information
jasperla and user committed Jan 3, 2024
1 parent 402ea1e commit 87270e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vlib/v/util/diff/diff.v
Expand Up @@ -25,8 +25,8 @@ pub fn find_working_diff_command() !string {
}
continue
}
$if freebsd {
if diffcmd == 'diff' { // FreeBSD diff has no `--version` option
$if freebsd || openbsd {
if diffcmd == 'diff' { // FreeBSD/OpenBSD diff have no `--version` option
return diffcmd
}
}
Expand Down Expand Up @@ -71,6 +71,9 @@ pub fn color_compare_files(diff_cmd string, file1 string, file2 string) string {
$if freebsd {
full_cmd = '${diff_cmd} --minimal --text --unified=2 ${os.quoted_path(file1)} ${os.quoted_path(file2)} '
}
$if openbsd {
full_cmd = '${diff_cmd} -d -a -U 2 ${os.quoted_path(file1)} ${os.quoted_path(file2)} '
}
x := os.execute(full_cmd)
if x.exit_code < 0 {
return 'comparison command: `${full_cmd}` not found'
Expand Down

0 comments on commit 87270e9

Please sign in to comment.