Exit with non-zero status when Aborting!: out of memory...
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Wed, 29 Feb 2012 19:00:02 +0000 (12:00 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Wed, 29 Feb 2012 19:00:02 +0000 (12:00 -0700)
...when run with --batch-mode.  This correctly signals to make(1) that
there was an error.

I used nearest-cmdl/batch-mode? though I wonder what a "batch level"
is.  Such a thing should probably cmdl-interrupt/abort-previous rather
than %exit, but this short-circuits the whole gc-clean recovery
effort.  I find similar yuck (a call to %exit) in ttyio.scm's
operation/read-char.

src/runtime/gc.scm

index fba1c9d7bea4a712fcfe66aaa5611ab7fd260065..388ab88a9eedcf399bc986002901926b07f6e702 100644 (file)
@@ -159,9 +159,13 @@ USA.
            (cmdl-message/strings "Aborting!: out of memory")
            ;; Clean up whatever possible to avoid a reoccurrence.
            (cmdl-message/active
-            (lambda (port)
-              port
-              (with-gc-notification! #t gc-clean)))))))
+            (if (nearest-cmdl/batch-mode?)
+                (lambda (port)
+                  (newline port)
+                  (%exit 1))
+                (lambda (port)
+                  port
+                  (with-gc-notification! #t gc-clean))))))))
   ((ucode-primitive request-interrupts! 1) interrupt-bit/after-gc)
   (hook/gc-finish start-value space-remaining))