diff --git a/bin/relate b/bin/relate
index ca90b68d784db0a17be03e0b2e1687c900053aef..f5de902ece5412c470031e18607e02700c41e257 100644
--- a/bin/relate
+++ b/bin/relate
@@ -12,10 +12,15 @@ def validate(args):
     django.setup()
 
     from course.validation import validate_course_on_filesystem
-    validate_course_on_filesystem(args.REPO_ROOT,
+    has_warnings = validate_course_on_filesystem(args.REPO_ROOT,
             course_file=args.course_file,
             events_file=args.events_file)
 
+    if has_warnings:
+        return 1
+    else:
+        return 0
+
 
 # {{{ code test
 
@@ -181,6 +186,8 @@ def test_code(args):
         print("EXAMINING", yml_file)
         test_code_yml(yml_file, repo_root=args.repo_root)
 
+    return 0
+
 # }}}
 
 
@@ -210,7 +217,8 @@ def main():
         import sys
         sys.exit(1)
 
-    args.func(args)
+    import sys
+    sys.exit(args.func(args))
 
 
 if __name__ == "__main__":
diff --git a/course/validation.py b/course/validation.py
index fa7fb0f6e061c219faca1f4a783d9162ed7573a4..e4878ff713c0806e20a856fc4af35a3296560aae 100644
--- a/course/validation.py
+++ b/course/validation.py
@@ -1409,6 +1409,8 @@ def validate_course_on_filesystem(
         for w in warnings:
             print("***", w.location, w.text)
 
+    return bool(warnings)
+
 # }}}
 
 # vim: foldmethod=marker