run-jsc should exit with the same signal or exit status that the `jsc` shell does
https://bugs.webkit.org/show_bug.cgi?id=204778

Reviewed by Keith Miller.

* Scripts/run-jsc:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 7ca821c..fa0a466 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,12 @@
+2019-12-02  Saam Barati  <sbarati@apple.com>
+
+        run-jsc should exit with the same signal or exit status that the `jsc` shell does
+        https://bugs.webkit.org/show_bug.cgi?id=204778
+
+        Reviewed by Keith Miller.
+
+        * Scripts/run-jsc:
+
 2019-12-02  Aakash Jain  <aakash_jain@apple.com>
 
         Revert - [EWS] Do not retry layout-tests build if the flaky test failures are also present in clean tree run
diff --git a/Tools/Scripts/run-jsc b/Tools/Scripts/run-jsc
index 4e6d944..d9a07f3 100755
--- a/Tools/Scripts/run-jsc
+++ b/Tools/Scripts/run-jsc
@@ -37,6 +37,8 @@
 use webkitdirs;
 Getopt::Long::Configure("no_auto_abbrev", "pass_through");
 
+use English;
+
 my $usage = "Usage: run-jsc [--count run_count] [--debugger] shell_file [file2...]";
 
 my $count = 1;
@@ -61,7 +63,13 @@
 print STDERR "Running $count time(s): DYLD_FRAMEWORK_PATH=$dyld $jsc\n";
 
 while ($count--) {
-    my $status = system("$jsc") >> 8;
+    system("$jsc");
+    my $signal = $? & 0x7f;
+    my $status = ($? >> 8) & 0xff;
+    if ($signal != 0) {
+        system("kill -" . $signal . " " . $PID); # We kill ourselves with the same signal that the `jsc` process was killed with to make it look like `jsc` was directly invoked.
+        print STDERR "\n... I should not be here ...\n";
+    }
     if ($status != 0) {
         print STDERR "\njsc exited with non-zero status: $status\n";
         exit $status;