diff --git a/src/profile-editor.c b/src/profile-editor.c
index d76b9d2..89e4b44 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -692,6 +692,11 @@ terminal_profile_edit (TerminalProfile *profile,
   }
   g_free (path);
 
+#if VTE_CHECK_VERSION (0,17, 5)
+  w = (GtkWidget *) gtk_builder_get_object  (builder, "exit-action-combobox");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("Hold the terminal open only on nonzero exit status"));
+#endif
+
   editor = (GtkWidget *) gtk_builder_get_object  (builder, "profile-editor-dialog");
   g_object_set_data_full (G_OBJECT (editor), "builder",
                           builder, (GDestroyNotify) g_object_unref);
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 596a585..9dded9f 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -1753,6 +1753,11 @@ terminal_app_handle_options (TerminalApp *app,
                                               options->env,
                                               it->zoom_set ? it->zoom : options->zoom);
 
+          if (it->exit_action_set)
+            terminal_screen_set_override_exit_action (screen, it->exit_action);
+          else if (options->default_exit_action_set)
+            terminal_screen_set_override_exit_action (screen, options->default_exit_action);
+
           if (it->active)
             terminal_window_switch_screen (window, screen);
         }
diff --git a/src/terminal-options.c b/src/terminal-options.c
index 65fc899..550732f 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -611,6 +611,42 @@ option_zoom_callback (const gchar *option_name,
   return TRUE;
 }
 
+static gboolean
+option_exit_action_callback (const char *option_name,
+                             const char *value,
+                             gpointer    data,
+                             GError    **error)
+{
+  TerminalOptions *options = data;
+  TerminalExitAction action;
+
+  if (strcmp (option_name, "--exit-close") == 0)
+    action = TERMINAL_EXIT_HOLD;
+  else if (strcmp (option_name, "--exit-hold") == 0)
+    action = TERMINAL_EXIT_HOLD;
+  else if (strcmp (option_name, "--exit-restart") == 0)
+    action = TERMINAL_EXIT_RESTART;
+#if VTE_CHECK_VERSION (0, 17, 5)
+  else if (strcmp (option_name, "--exit-hold-failure") == 0)
+    action = TERMINAL_EXIT_HOLD_IF_NONZERO_STATUS;
+#endif
+
+  if (options->initial_windows)
+    {
+      InitialTab *it = ensure_top_tab (options);
+
+      it->exit_action = action;
+      it->exit_action_set = TRUE;
+    }
+  else
+    {
+      options->default_exit_action = action;
+      options->default_exit_action_set = TRUE;
+    }
+
+  return TRUE;
+}
+
 /* Evaluation of the arguments given to the command line options */
 static gboolean
 digest_options_callback (GOptionContext *context,
@@ -916,6 +952,40 @@ get_goption_context (TerminalOptions *options)
       N_("Set the terminalx's zoom factor (1.0 = normal size)"),
       N_("ZOOM")
     },
+    {
+      "exit-close",
+      0,
+      G_OPTION_FLAG_NO_ARG,
+      G_OPTION_ARG_CALLBACK,
+      option_exit_action_callback,
+      N_("FIXME"), NULL
+    },
+    {
+      "exit-hold",
+      0,
+      G_OPTION_FLAG_NO_ARG,
+      G_OPTION_ARG_CALLBACK,
+      option_exit_action_callback,
+      N_("FIXME"), NULL
+    },
+    {
+      "exit-restart",
+      0,
+      G_OPTION_FLAG_NO_ARG,
+      G_OPTION_ARG_CALLBACK,
+      option_exit_action_callback,
+      N_("FIXME"), NULL
+    },
+#if VTE_CHECK_VERSION (0, 17, 5)
+    {
+      "exit-hold-failure",
+      0,
+      G_OPTION_FLAG_NO_ARG,
+      G_OPTION_ARG_CALLBACK,
+      option_exit_action_callback,
+      N_("FIXME"), NULL
+    },
+#endif
     { NULL, 0, 0, 0, NULL, NULL, NULL }
   };
 
diff --git a/src/terminal-options.h b/src/terminal-options.h
index e221712..451d7e5 100644
--- a/src/terminal-options.h
+++ b/src/terminal-options.h
@@ -24,6 +24,8 @@
 
 #include <glib.h>
 
+#include "terminal-profile.h"
+
 G_BEGIN_DECLS
 
 typedef struct
@@ -45,6 +47,9 @@ typedef struct
   char    *default_profile;
   gboolean default_profile_is_id;
 
+  TerminalExitAction default_exit_action;
+  gboolean default_exit_action_set;
+
   gboolean  execute;
   gboolean  use_factory;
   double    zoom;
@@ -58,8 +63,11 @@ typedef struct
   char *title;
   char *working_dir;
   double zoom;
+  TerminalExitAction exit_action;
+
   guint zoom_set : 1;
   guint active : 1;
+  guint exit_action_set : 1;
 } InitialTab;
 
 typedef struct
diff --git a/src/terminal-profile.h b/src/terminal-profile.h
index 04748fd..7833128 100644
--- a/src/terminal-profile.h
+++ b/src/terminal-profile.h
@@ -23,6 +23,7 @@
 #define TERMINAL_PROFILE_H
 
 #include <gtk/gtk.h>
+#include <vte/vte.h>
 
 G_BEGIN_DECLS
 
@@ -46,7 +47,12 @@ typedef enum
 {
   TERMINAL_EXIT_CLOSE,
   TERMINAL_EXIT_RESTART,
+#if VTE_CHECK_VERSION (0, 17, 5)
+  TERMINAL_EXIT_HOLD,
+  TERMINAL_EXIT_HOLD_IF_NONZERO_STATUS
+#else
   TERMINAL_EXIT_HOLD
+#endif
 } TerminalExitAction;
 
 typedef enum
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 9bd807d..03c096d 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -39,6 +39,7 @@
 #include "terminal-screen-container.h"
 #include "terminal-util.h"
 #include "terminal-window.h"
+#include "terminal-type-builtins.h"
 
 #include "eggshell.h"
 
@@ -65,6 +66,8 @@ struct _TerminalScreenPrivate
   gboolean icon_title_set;
   char **initial_env;
   char **override_command;
+  TerminalExitAction exit_action;
+  gboolean exit_action_set;
   char *working_dir;
   int child_pid;
   double font_scale;
@@ -89,7 +92,8 @@ enum {
   PROP_ICON_TITLE_SET,
   PROP_OVERRIDE_COMMAND,
   PROP_TITLE,
-  PROP_INITIAL_ENVIRONMENT
+  PROP_INITIAL_ENVIRONMENT,
+  PROP_EXIT_ACTION
 };
 
 enum
@@ -403,6 +407,9 @@ terminal_screen_get_property (GObject *object,
       case PROP_INITIAL_ENVIRONMENT:
         g_value_set_boxed (value, terminal_screen_get_initial_environment (screen));
         break;
+      case PROP_EXIT_ACTION:
+        g_value_set_enum (value, terminal_screen_get_override_exit_action (screen));
+        break;
       case PROP_TITLE:
         g_value_set_string (value, terminal_screen_get_title (screen));
         break;
@@ -436,6 +443,9 @@ terminal_screen_set_property (GObject *object,
       case PROP_INITIAL_ENVIRONMENT:
         terminal_screen_set_initial_environment (screen, g_value_get_boxed (value));
         break;
+      case PROP_EXIT_ACTION:
+        terminal_screen_set_override_exit_action (screen, g_value_get_enum (value));
+        break;
       case PROP_ICON_TITLE:
       case PROP_ICON_TITLE_SET:
       case PROP_TITLE:
@@ -550,6 +560,14 @@ terminal_screen_class_init (TerminalScreenClass *klass)
                          G_TYPE_STRV,
                          G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 
+  g_object_class_install_property
+    (object_class,
+     PROP_EXIT_ACTION,
+     g_param_spec_enum ("override-exit-action", NULL, NULL,
+                        TERMINAL_TYPE_EXIT_ACTION,
+                        TERMINAL_EXIT_CLOSE,
+                        G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
   g_type_class_add_private (object_class, sizeof (TerminalScreenPrivate));
 
   /* Precompile the regexes */
@@ -1124,6 +1142,22 @@ terminal_screen_get_initial_environment (TerminalScreen *screen)
   return screen->priv->initial_env;
 }
 
+void
+terminal_screen_set_override_exit_action (TerminalScreen *screen,
+                                          TerminalExitAction action)
+{
+  TerminalScreenPrivate *priv = screen->priv;
+  
+  priv->exit_action = action;
+  priv->exit_action_set = TRUE;
+}
+
+TerminalExitAction
+terminal_screen_get_override_exit_action (TerminalScreen *screen)
+{
+  return screen->priv->exit_action;
+}
+
 static void
 show_command_error_dialog (TerminalScreen *screen,
                            GError         *error)
@@ -1796,8 +1830,11 @@ terminal_screen_child_exited (VteTerminal *terminal)
   /* No need to chain up to VteTerminalClass::child_exited since it's NULL */
 
   priv->child_pid = -1;
-  
-  action = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_EXIT_ACTION);
+
+  if (priv->exit_action_set)
+    action = priv->exit_action;
+  else
+    action = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_EXIT_ACTION);
   
   switch (action)
     {
@@ -1807,6 +1844,17 @@ terminal_screen_child_exited (VteTerminal *terminal)
     case TERMINAL_EXIT_RESTART:
       terminal_screen_launch_child (screen);
       break;
+#if VTE_CHECK_VERSION (0, 17, 5)
+    case TERMINAL_EXIT_HOLD_IF_NONZERO_STATUS: {
+      int status;
+
+      status = vte_terminal_get_child_exit_status (VTE_TERMINAL (screen));
+      if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
+        g_signal_emit (screen, signals[CLOSE_SCREEN], 0);
+
+      break;
+    }
+#endif /* VTE >= 0.17.5 */
     case TERMINAL_EXIT_HOLD:
       break;
     }
diff --git a/src/terminal-screen.h b/src/terminal-screen.h
index 0846440..b4310db 100644
--- a/src/terminal-screen.h
+++ b/src/terminal-screen.h
@@ -88,6 +88,11 @@ void         terminal_screen_set_initial_environment (TerminalScreen  *screen,
                                                       char           **argv);
 char **      terminal_screen_get_initial_environment (TerminalScreen  *screen);
 
+void         terminal_screen_set_override_exit_action (TerminalScreen *screen,
+                                                       TerminalExitAction action);
+
+TerminalExitAction terminal_screen_get_override_exit_action (TerminalScreen *screen);
+
 void terminal_screen_launch_child (TerminalScreen *screen);
 
 const char* terminal_screen_get_raw_title      (TerminalScreen *screen);
