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-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 3ac6839..34dbfaa 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1789,7 +1789,6 @@ terminal_screen_icon_title_changed (VteTerminal *vte_terminal,
   queue_recheck_working_dir (screen);
 }
 
-
 static void
 terminal_screen_widget_child_died (GtkWidget      *term,
                                    TerminalScreen *screen)
@@ -1809,6 +1808,17 @@ terminal_screen_widget_child_died (GtkWidget      *term,
     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;
     }
