12.4.25 Embedding SWI-Prolog in other applications
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Embedding SWI-Prolog in other applications
            • PL_initialise()
            • PL_winitialise()
            • PL_is_initialised()
            • PL_set_resource_db_mem()
            • PL_toplevel()
            • PL_cleanup()
            • PL_cleanup_fork()
            • PL_save_ctty()
            • PL_restore_ctty()
            • PL_halt()
            • Threading, Signals and embedded Prolog
    • Packages
Availability:C-language interface function
void * PL_save_ctty()
Prepare for running a child process on the terminal of the calling thread's user_input, user_output and user_error when that terminal is not the controlling terminal of our session, such as the pty of an Epilog window. A child that makes such a terminal its controlling terminal is the leader of its session, and BSD kernels, including MacOS, revoke the terminal when that leader exits, leaving Prolog's descriptors on it unusable. Call this before creating the child and pass the result to PL_restore_ctty() after the child has been reaped. Returns NULL if there is nothing to restore, notably when running on the controlling terminal and on systems that do not revoke. The returned state holds resources and must always be passed to PL_restore_ctty(). Used by shell/1 and process_create/3.