rework --ignoreSigInt

Send it through the main signal handler so we can see resource stats and
what was running at the time we got the SIGINT, and print an FYI note
that we're ignoring it.

Change-Id: Id3bee87d8d07c3ee74b5443198327b7b14d12ddf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201867
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/dm/DM.cpp b/dm/DM.cpp
index a04b3dc..05c7675 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -291,8 +291,13 @@
     #endif
         fflush(stdout);
 
-        signal(sig, previous_handler[sig]);
-        raise(sig);
+        if (sig == SIGINT && FLAGS_ignoreSigInt) {
+            info("Ignoring signal %d because of --ignoreSigInt.\n"
+                 "This is probably a sign the bot is overloaded with work.\n", sig);
+        } else {
+            signal(sig, previous_handler[sig]);
+            raise(sig);
+        }
     }
 
     static void setup_crash_handler() {
@@ -300,10 +305,6 @@
         for (int sig : kSignals) {
             previous_handler[sig] = signal(sig, crash_handler);
         }
-
-        if (FLAGS_ignoreSigInt) {
-            signal(SIGINT, SIG_IGN);
-        }
     }
 #endif