diffcmd runs the supplied command, saves the output, and prints diff if it changed since the last time the command was run:
$ diffcmd -h
Usage: diffcmd -n IDENT [-U N] [-F RE] [-I RE] -- COMMAND [ARG...]
$ diffcmd -n test -- bash -c 'echo $RANDOM'
--- old/test
+++ new/test
@@ -0,0 +1 @@
+4074
$ diffcmd -n test -- bash -c 'echo $RANDOM'
--- old/test
+++ new/test
@@ -1 +1 @@
-4074
+32451