Skip to content

Commit 4e95310

Browse files
gergnzstefankoegl
authored andcommitted
If there is no diff print nothing; exit 1 if a diff is found (#53)
if there is no diff print nothing, and exit 1 if a diff is found
1 parent 55e0c43 commit 4e95310

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bin/jsondiff

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ def diff_files():
3232
doc1 = json.load(args.FILE1)
3333
doc2 = json.load(args.FILE2)
3434
patch = jsonpatch.make_patch(doc1, doc2)
35-
print(json.dumps(patch.patch, indent=args.indent))
36-
35+
if patch.patch:
36+
print(json.dumps(patch.patch, indent=args.indent))
37+
sys.exit(1)
3738

3839
if __name__ == "__main__":
3940
main()

0 commit comments

Comments
 (0)