]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply terminal session: Drop ply_terminal_session_run, this is a feature from a bygone...
authorZhaoQiang <zhaoqiangx@gmail.com>
Thu, 11 Jul 2019 21:53:31 +0000 (21:53 +0000)
committerRay Strode <halfline@gmail.com>
Thu, 11 Jul 2019 21:53:31 +0000 (21:53 +0000)
src/libply/ply-terminal-session.c
src/libply/ply-terminal-session.h

index 5cecbbdbbea17f882aac128e173305cccd2a8dc4..50193328924c5534bf49e4eb3e560590679c892a 100644 (file)
@@ -263,80 +263,6 @@ open_pseudoterminal (ply_terminal_session_t *session)
         return true;
 }
 
-
-bool
-ply_terminal_session_run (ply_terminal_session_t               *session,
-                          ply_terminal_session_flags_t          flags,
-                          ply_terminal_session_begin_handler_t  begin_handler,
-                          ply_terminal_session_output_handler_t output_handler,
-                          ply_terminal_session_hangup_handler_t hangup_handler,
-                          void                                 *user_data)
-{
-        pid_t pid;
-        bool run_in_parent, look_in_path, should_redirect_console;
-
-        assert (session != NULL);
-        assert (session->loop != NULL);
-        assert (!session->is_running);
-        assert (session->hangup_handler == NULL);
-
-        run_in_parent = (flags & PLY_TERMINAL_SESSION_FLAGS_RUN_IN_PARENT) != 0;
-        look_in_path = (flags & PLY_TERMINAL_SESSION_FLAGS_LOOK_IN_PATH) != 0;
-        should_redirect_console =
-                (flags & PLY_TERMINAL_SESSION_FLAGS_REDIRECT_CONSOLE) != 0;
-
-        ply_trace ("creating terminal device");
-        if (!open_pseudoterminal (session))
-                return false;
-        ply_trace ("done creating terminal device");
-
-        if (should_redirect_console)
-                ply_trace ("redirecting system console to terminal device");
-        if (should_redirect_console &&
-            !ply_terminal_session_redirect_console (session)) {
-                ply_save_errno ();
-                close_pseudoterminal (session);
-                ply_restore_errno ();
-                return false;
-        }
-        if (should_redirect_console)
-                ply_trace ("done redirecting system console to terminal device");
-
-        ply_trace ("creating subprocess");
-        pid = fork ();
-
-        if (pid < 0) {
-                ply_save_errno ();
-                ply_terminal_session_unredirect_console (session);
-                close_pseudoterminal (session);
-                ply_restore_errno ();
-                return false;
-        }
-
-        if (((pid == 0) && run_in_parent) ||
-            ((pid != 0) && !run_in_parent)) {
-                session->is_running = true;
-                session->output_handler = output_handler;
-                session->hangup_handler = hangup_handler;
-                session->user_data = user_data;
-                ply_terminal_session_start_logging (session);
-
-                return true;
-        }
-
-        if (begin_handler != NULL) {
-                ply_trace ("running 'begin handler'");
-                begin_handler (user_data, session);
-                ply_trace ("ran 'begin handler'");
-        }
-
-        ply_trace ("beginning session");
-        ply_terminal_session_execute (session, look_in_path);
-
-        _exit (errno);
-        return false;
-}
-
 bool
 ply_terminal_session_attach (ply_terminal_session_t               *session,
                              ply_terminal_session_flags_t          flags,
index 26a47c99610759e277257f1dee5f3553722a076d..5bd5cfd1ad6712558a690dd74833dc39ad0342a2 100644 (file)
@@ -54,12 +54,6 @@ ply_terminal_session_t *ply_terminal_session_new (const char *const *argv);
 void ply_terminal_session_free (ply_terminal_session_t *session);
 void ply_terminal_session_attach_to_event_loop (ply_terminal_session_t *session,
                                                 ply_event_loop_t       *loop);
-bool ply_terminal_session_run (ply_terminal_session_t               *session,
-                               ply_terminal_session_flags_t          flags,
-                               ply_terminal_session_begin_handler_t  begin_handler,
-                               ply_terminal_session_output_handler_t output_handler,
-                               ply_terminal_session_hangup_handler_t done_handler,
-                               void                                 *user_data);
 
 bool ply_terminal_session_attach (ply_terminal_session_t               *session,
                                   ply_terminal_session_flags_t          flags,