diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java
index dc891a94003a5e84a79b27dc8077cea4b4fbacb4..901c6bff41d77914a65c9d9a45728c16608f1131 100644
--- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java
+++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCommand.java
@@ -296,7 +296,8 @@ public class RCommand {
                 context.eval(QUIT_EOF);
             } catch (PolyglotException e2) {
                 if (e2.isExit()) {
-                    return e2.getExitStatus();
+                    // don't use the exit code from the PolyglotException
+                    return lastStatus;
                 }
                 throw fatal(e, "error while calling quit");
             }