Next Previous Contents

18. Subprocess Functions

18.1 get_process_input

Synopsis

get_process_input

Usage

Void get_process_input (Int_Type tsecs);

Description

Read all pending input by all subprocesses. If no input is available, this function will wait for input until tsecs tenth of seconds have expired.

18.2 kill_process

Synopsis

kill_process

Usage

Void kill_process (Int_Type id);

Description

Kill the subprocess specified by the process handle id.

18.3 open_process

Synopsis

open_process

Usage

Int_Type open_process (name, argv1, argv2, ..., argvN, N);

Description

Returns id of process, -1 upon failure.

18.4 process_mark

Synopsis

process_mark

Usage

User_Mark process_mark (Int_Type id);

Description

This function returns the user mark that contains the position of the last output by the process.

18.5 process_query_at_exit

Synopsis

Whether or not to silently kill a process at exit

Usage

Void process_query_at_exit (Int_Type pid, Int_Type query)

Description

The process_query_at_exit may be used to specify whether or not the process specified by pid should be silently ignored when the editor exits. If the parameter query is non-zero, the user will be reminded the process exists before exiting.

See Also

open_process, kill_process, exit_jed

18.6 run_shell_cmd

Synopsis

run_shell_cmd

Usage

Void run_shell_cmd (String cmd);

Description

The run_shell_cmd function may be used to run cmd in a separate process. Any output generated by the process is inserted into the buffer at the current point. It generates a S-Lang error if the process specified by cmd could not be opened. Otherwise, it returns the exit status of the process.

18.7 send_process

Synopsis

send_process

Usage

Void send_process (Int_Type id, String s);

Description

Undocumented

18.8 send_process_eof

Synopsis

send_process_eof

Usage

send_process_eof (Int_Type pid);

Description

This function closes the stdin of the process specified by the handle pid.

18.9 set_process

Synopsis

set_process

Usage

Void set_process (Int_Type pid, String what, String value);

Description

pid is the process handle returned by open_process. The second parameter, what, specifies what to set. It must be one of the strings:

        "signal" :  indicates that 'value' is the name of a function to call
                    when the process status changed.  The function specified
                    by 'value' must be declared to accept an argument list:
                    (pid, flags, status) where 'pid' has the same
                    meaning as above and flags is an integer with the
                    meanings: 
                      1: Process Running
                      2: Process Stopped
                      4: Process Exited Normally
                      8: Process Exited via Signal
                    The meaning of the \var{status} parameter depends
                    upon the \var{flags} parameter.  If the process
                    exited normally, then \var{status} indicates its
                    return status.  Otherwise \var{status} represents
                    the signal that either stopped or killed the
                    process.
                    Note: when this function is called, the current buffer is
                    guaranteed to be the buffer associated with the process.
       
       "output" :   This parameter determines how output from the process is
                    is processed.  If the 'value' is the empty string "", output
                    will go to the end of the buffer associated with the process
                    and the point will be left there.
                    If value is ".", output will go at the current buffer position.
                    If value is "@", output will go to the end of the buffer but
                    the point will not move.  Otherwise, 'value' is the name of
                    a slang function with arguments: (pid, data) where pid has
                    the above meaning and data is the output from the process.

18.10 signal_process

Synopsis

signal_process

Usage

Void signal_process (Int_Type pid, Int_Type signum);

Description

This function may be used to send a signal to the process whose process handle is given by pid. The pid must be a valid handle that was returned by open_process.

See Also

open_process, kill_process, send_process_eof


Next Previous Contents