<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="GCutProcess">
<refmeta>
<refentrytitle role="top_of_page" id="GCutProcess.top_of_page">External command</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  CUTTER Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>External command</refname>
<refpurpose>Convenience API for using external
command.</refpurpose>
</refnamediv>

<refsynopsisdiv id="GCutProcess.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>#define             <link linkend="GCUT-PROCESS-ERROR:CAPS">GCUT_PROCESS_ERROR</link>
                    <link linkend="GCutProcess-struct">GCutProcess</link>;
                    <link linkend="GCutProcessClass">GCutProcessClass</link>;
enum                <link linkend="GCutProcessError">GCutProcessError</link>;
<link linkend="GQuark"><returnvalue>GQuark</returnvalue></link>              <link linkend="gcut-process-error-quark">gcut_process_error_quark</link>            (<parameter><type>void</type></parameter>);
<link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       <link linkend="gcut-process-new">gcut_process_new</link>                    (<parameter>const <link linkend="gchar"><type>gchar</type></link> *command</parameter>,
                                                         <parameter>...</parameter>);
<link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       <link linkend="gcut-process-new-command-line">gcut_process_new_command_line</link>       (<parameter>const <link linkend="gchar"><type>gchar</type></link> *command_line</parameter>);
<link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       <link linkend="gcut-process-new-va-list">gcut_process_new_va_list</link>            (<parameter>const <link linkend="gchar"><type>gchar</type></link> *command</parameter>,
                                                         <parameter><link linkend="va-list"><type>va_list</type></link> args</parameter>);
<link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       <link linkend="gcut-process-new-argv">gcut_process_new_argv</link>               (<parameter><link linkend="gint"><type>gint</type></link> argc</parameter>,
                                                         <parameter><link linkend="gchar"><type>gchar</type></link> **argv</parameter>);
<link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       <link linkend="gcut-process-new-strings">gcut_process_new_strings</link>            (<parameter>const <link linkend="gchar"><type>gchar</type></link> **command</parameter>);
<link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       <link linkend="gcut-process-new-array">gcut_process_new_array</link>              (<parameter><link linkend="GArray"><type>GArray</type></link> *command</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="gcut-process-set-flags">gcut_process_set_flags</link>              (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GSpawnFlags"><type>GSpawnFlags</type></link> flags</parameter>);
<link linkend="GSpawnFlags"><returnvalue>GSpawnFlags</returnvalue></link>         <link linkend="gcut-process-get-flags">gcut_process_get_flags</link>              (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="gcut-process-set-env">gcut_process_set_env</link>                (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *name</parameter>,
                                                         <parameter>...</parameter>);
<link linkend="gchar"><returnvalue>gchar</returnvalue></link> **            <link linkend="gcut-process-get-env">gcut_process_get_env</link>                (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            <link linkend="gcut-process-run">gcut_process_run</link>                    (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);
<link linkend="GPid"><returnvalue>GPid</returnvalue></link>                <link linkend="gcut-process-get-pid">gcut_process_get_pid</link>                (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="gint"><returnvalue>gint</returnvalue></link>                <link linkend="gcut-process-wait">gcut_process_wait</link>                   (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="guint"><type>guint</type></link> timeout</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            <link linkend="gcut-process-kill">gcut_process_kill</link>                   (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="gint"><type>gint</type></link> signal_number</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            <link linkend="gcut-process-write">gcut_process_write</link>                  (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *chunk</parameter>,
                                                         <parameter><link linkend="gsize"><type>gsize</type></link> size</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);
<link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>           <link linkend="gcut-process-flush">gcut_process_flush</link>                  (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);
<link linkend="GString"><returnvalue>GString</returnvalue></link> *           <link linkend="gcut-process-get-output-string">gcut_process_get_output_string</link>      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="GString"><returnvalue>GString</returnvalue></link> *           <link linkend="gcut-process-get-error-string">gcut_process_get_error_string</link>       (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link> *        <link linkend="gcut-process-get-input-channel">gcut_process_get_input_channel</link>      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link> *        <link linkend="gcut-process-get-output-channel">gcut_process_get_output_channel</link>     (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link> *        <link linkend="gcut-process-get-error-channel">gcut_process_get_error_channel</link>      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="GInputStream"><returnvalue>GInputStream</returnvalue></link> *      <link linkend="gcut-process-get-output-stream">gcut_process_get_output_stream</link>      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="GInputStream"><returnvalue>GInputStream</returnvalue></link> *      <link linkend="gcut-process-get-error-stream">gcut_process_get_error_stream</link>       (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="guint"><returnvalue>guint</returnvalue></link>               <link linkend="gcut-process-get-forced-termination-wait-time">gcut_process_get_forced_termination_wait_time</link>
                                                        (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="gcut-process-set-forced-termination-wait-time">gcut_process_set_forced_termination_wait_time</link>
                                                        (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="guint"><type>guint</type></link> timeout</parameter>);
<link linkend="GCutEventLoop"><returnvalue>GCutEventLoop</returnvalue></link> *     <link linkend="gcut-process-get-event-loop">gcut_process_get_event_loop</link>         (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="gcut-process-set-event-loop">gcut_process_set_event_loop</link>         (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GCutEventLoop"><type>GCutEventLoop</type></link> *loop</parameter>);
</synopsis>
</refsynopsisdiv>
<refsect1 id="GCutProcess.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----GCutProcess
</synopsis>
</refsect1>
<refsect1 id="GCutProcess.properties" role="properties">
<title role="properties.title">Properties</title>
<synopsis>
  &quot;<link linkend="GCutProcess--command">command</link>&quot;                  <link linkend="gpointer"><type>gpointer</type></link>              : Read / Write
</synopsis>
</refsect1>
<refsect1 id="GCutProcess.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<synopsis>
  &quot;<link linkend="GCutProcess-error">error</link>&quot;                                          : Run Last
  &quot;<link linkend="GCutProcess-error-received">error-received</link>&quot;                                 : Run Last
  &quot;<link linkend="GCutProcess-output-received">output-received</link>&quot;                                : Run Last
  &quot;<link linkend="GCutProcess-reaped">reaped</link>&quot;                                         : Run Last
</synopsis>
</refsect1>

<refsect1 id="GCutProcess.description" role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="GCutProcess"><type>GCutProcess</type></link> encapsulates external command execution,
communication and termination. <link linkend="GCutProcess"><type>GCutProcess</type></link> reports an error
as <link linkend="GError"><type>GError</type></link>. It can be asserted easily by
<link linkend="gcut-assert-error"><function>gcut_assert_error()</function></link>.
</para>
<para>
External command is specified to constructor like
<link linkend="gcut-process-new"><function>gcut_process_new()</function></link>, <link linkend="gcut-process-new-strings"><function>gcut_process_new_strings()</function></link> and so
on. External command isn't run at the
time. <link linkend="gcut-process-run"><function>gcut_process_run()</function></link> runs specified external command.
</para>
<para>
Standard/Error outputs of external command are passed by
<link linkend="GCutProcess-output-received"><type>"output-received"</type></link>/<link linkend="GCutProcess-error-received"><type>"error-received"</type></link> signals
or <link linkend="GIOChannel"><type>GIOChannel</type></link> returned by
<link linkend="gcut-process-get-output"><function>gcut_process_get_output()</function></link>/<link linkend="gcut-process-get-error"><function>gcut_process_get_error()</function></link>.
<link linkend="gcut-process-write"><function>gcut_process_write()</function></link> writes a chunk to standard input of
external command.
</para>
<para>
To wait external command finished, <link linkend="gcut-process-wait"><function>gcut_process_wait()</function></link> can be
used. It accepts timeout to avoid infinite waiting.
</para>
<para>
e.g.:
<informalexample><programlisting>
static GString *output_string;
static GCutProcess *process;

void
cut_setup (void)
{
    output_string = g_string_new(NULL);
    process = NULL;
}

void
cut_teardown (void)
{
    if (output_string)
        g_string_free(output_string, TRUE);
    if (process)
        g_object_unref(process);
}

static void
cb_output_received (GCutProcess *process, const gchar *chunk, gsize size,
                    gpointer user_data)
{
    g_string_append_len(output_string, chunk, size);
}

void
test_echo (void)
{
    GError *error = NULL;

    process = gcut_process_new("echo", "XXX", NULL);
    g_signal_connect(process, "receive-output",
                     G_CALLBACK(cb_output_received), NULL);

    gcut_process_run(process, &amp;error);
    gcut_assert_error(error);

    gcut_process_wait(process, 1000, &amp;error);
    gcut_assert_error(error);
    cut_assert_equal_string("XXX\n", output_string->str);
}
</programlisting></informalexample>
</para>
</refsect1>
<refsect1 id="GCutProcess.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GCUT-PROCESS-ERROR:CAPS" role="macro">
<title>GCUT_PROCESS_ERROR</title>
<indexterm zone="GCUT-PROCESS-ERROR:CAPS"><primary>GCUT_PROCESS_ERROR</primary></indexterm>
<programlisting>#define GCUT_PROCESS_ERROR           (gcut_process_error_quark())
</programlisting>
<para>
</para></refsect2>
<refsect2 id="GCutProcess-struct" role="struct">
<title>GCutProcess</title>
<indexterm zone="GCutProcess-struct"><primary>GCutProcess</primary></indexterm>
<programlisting>typedef struct _GCutProcess GCutProcess;</programlisting>
<para>
</para></refsect2>
<refsect2 id="GCutProcessClass" role="struct">
<title>GCutProcessClass</title>
<indexterm zone="GCutProcessClass"><primary>GCutProcessClass</primary></indexterm>
<programlisting>typedef struct {
    GObjectClass parent_class;

    void (*output_received) (GCutProcess *process,
                             const gchar *chunk,
                             gsize        size);
    void (*error_received)  (GCutProcess *process,
                             const gchar *chunk,
                             gsize        size);
    void (*reaped)          (GCutProcess *process,
                             gint         status);
    void (*error)           (GCutProcess *process,
                             GError      *error);
} GCutProcessClass;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="GCutProcessError" role="enum" condition="since:1.1.5">
<title>enum GCutProcessError</title>
<indexterm zone="GCutProcessError" role="1.1.5"><primary>GCutProcessError</primary></indexterm>
<programlisting>typedef enum
{
    GCUT_PROCESS_ERROR_COMMAND_LINE,
    GCUT_PROCESS_ERROR_IO_ERROR,
    GCUT_PROCESS_ERROR_ALREADY_RUNNING,
    GCUT_PROCESS_ERROR_NOT_RUNNING,
    GCUT_PROCESS_ERROR_INVALID_OBJECT,
    GCUT_PROCESS_ERROR_INVALID_SIGNAL,
    GCUT_PROCESS_ERROR_PERMISSION_DENIED,
    GCUT_PROCESS_ERROR_TIMEOUT
} GCutProcessError;
</programlisting>
<para>
Error codes returned by <link linkend="GCutProcess"><type>GCutProcess</type></link> related operations.
</para><variablelist role="enum">
<varlistentry id="GCUT-PROCESS-ERROR-COMMAND-LINE:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_COMMAND_LINE</literal></term>
<listitem><simpara>Command line related error.
</simpara></listitem>
</varlistentry>
<varlistentry id="GCUT-PROCESS-ERROR-IO-ERROR:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_IO_ERROR</literal></term>
<listitem><simpara>IO error.
</simpara></listitem>
</varlistentry>
<varlistentry id="GCUT-PROCESS-ERROR-ALREADY-RUNNING:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_ALREADY_RUNNING</literal></term>
<listitem><simpara>External command is already running.
</simpara></listitem>
</varlistentry>
<varlistentry id="GCUT-PROCESS-ERROR-NOT-RUNNING:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_NOT_RUNNING</literal></term>
<listitem><simpara>External command isn't running.
</simpara></listitem>
</varlistentry>
<varlistentry id="GCUT-PROCESS-ERROR-INVALID-OBJECT:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_INVALID_OBJECT</literal></term>
<listitem><simpara>Invalid <link linkend="GCutProcess"><type>GCutProcess</type></link> object is passed.
</simpara></listitem>
</varlistentry>
<varlistentry id="GCUT-PROCESS-ERROR-INVALID-SIGNAL:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_INVALID_SIGNAL</literal></term>
<listitem><simpara>Invalid signal is passed.
</simpara></listitem>
</varlistentry>
<varlistentry id="GCUT-PROCESS-ERROR-PERMISSION-DENIED:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_PERMISSION_DENIED</literal></term>
<listitem><simpara>Permission denied.
</simpara></listitem>
</varlistentry>
<varlistentry id="GCUT-PROCESS-ERROR-TIMEOUT:CAPS" role="constant">
<term><literal>GCUT_PROCESS_ERROR_TIMEOUT</literal></term>
<listitem><simpara>Timeout.
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-error-quark" role="function">
<title>gcut_process_error_quark ()</title>
<indexterm zone="gcut-process-error-quark"><primary>gcut_process_error_quark</primary></indexterm>
<programlisting><link linkend="GQuark"><returnvalue>GQuark</returnvalue></link>              gcut_process_error_quark            (<parameter><type>void</type></parameter>);</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gcut-process-new" role="function" condition="since:1.1.5">
<title>gcut_process_new ()</title>
<indexterm zone="gcut-process-new" role="1.1.5"><primary>gcut_process_new</primary></indexterm>
<programlisting><link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       gcut_process_new                    (<parameter>const <link linkend="gchar"><type>gchar</type></link> *command</parameter>,
                                                         <parameter>...</parameter>);</programlisting>
<para>
Creates a new <link linkend="GCutProcess"><type>GCutProcess</type></link> object that runs <parameter>command</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>command</parameter>&#160;:</term>
<listitem><simpara>the external command name to be ran
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara>the arguments for <parameter>command</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GCutProcess"><type>GCutProcess</type></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-new-command-line" role="function" condition="since:1.1.5">
<title>gcut_process_new_command_line ()</title>
<indexterm zone="gcut-process-new-command-line" role="1.1.5"><primary>gcut_process_new_command_line</primary></indexterm>
<programlisting><link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       gcut_process_new_command_line       (<parameter>const <link linkend="gchar"><type>gchar</type></link> *command_line</parameter>);</programlisting>
<para>
Creates a new <link linkend="GCutProcess"><type>GCutProcess</type></link> object that runs <parameter>command_line</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>command_line</parameter>&#160;:</term>
<listitem><simpara>a command line
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GCutProcess"><type>GCutProcess</type></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-new-va-list" role="function" condition="since:1.1.5">
<title>gcut_process_new_va_list ()</title>
<indexterm zone="gcut-process-new-va-list" role="1.1.5"><primary>gcut_process_new_va_list</primary></indexterm>
<programlisting><link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       gcut_process_new_va_list            (<parameter>const <link linkend="gchar"><type>gchar</type></link> *command</parameter>,
                                                         <parameter><link linkend="va-list"><type>va_list</type></link> args</parameter>);</programlisting>
<para>
Creates a new <link linkend="GCutProcess"><type>GCutProcess</type></link> object that runs <parameter>command</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>command</parameter>&#160;:</term>
<listitem><simpara>the external command name to be ran
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>args</parameter>&#160;:</term>
<listitem><simpara>arguments for <parameter>command</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GCutProcess"><type>GCutProcess</type></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-new-argv" role="function" condition="since:1.1.5">
<title>gcut_process_new_argv ()</title>
<indexterm zone="gcut-process-new-argv" role="1.1.5"><primary>gcut_process_new_argv</primary></indexterm>
<programlisting><link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       gcut_process_new_argv               (<parameter><link linkend="gint"><type>gint</type></link> argc</parameter>,
                                                         <parameter><link linkend="gchar"><type>gchar</type></link> **argv</parameter>);</programlisting>
<para>
Creates a new <link linkend="GCutProcess"><type>GCutProcess</type></link> object that runs <parameter>command</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>argc</parameter>&#160;:</term>
<listitem><simpara>the number of elements of <parameter>argv</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>argv</parameter>&#160;:</term>
<listitem><simpara>the external command name to be ran and arguments
of it.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GCutProcess"><type>GCutProcess</type></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-new-strings" role="function" condition="since:1.1.5">
<title>gcut_process_new_strings ()</title>
<indexterm zone="gcut-process-new-strings" role="1.1.5"><primary>gcut_process_new_strings</primary></indexterm>
<programlisting><link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       gcut_process_new_strings            (<parameter>const <link linkend="gchar"><type>gchar</type></link> **command</parameter>);</programlisting>
<para>
Creates a new <link linkend="GCutProcess"><type>GCutProcess</type></link> object that runs <parameter>command</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>command</parameter>&#160;:</term>
<listitem><simpara>the external command name to be ran and
arguments of it. <link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GCutProcess"><type>GCutProcess</type></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-new-array" role="function" condition="since:1.1.5">
<title>gcut_process_new_array ()</title>
<indexterm zone="gcut-process-new-array" role="1.1.5"><primary>gcut_process_new_array</primary></indexterm>
<programlisting><link linkend="GCutProcess"><returnvalue>GCutProcess</returnvalue></link> *       gcut_process_new_array              (<parameter><link linkend="GArray"><type>GArray</type></link> *command</parameter>);</programlisting>
<para>
Creates a new <link linkend="GCutProcess"><type>GCutProcess</type></link> object that runs <parameter>command</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>command</parameter>&#160;:</term>
<listitem><simpara>the external command name to be ran and
arguments of it. The <link linkend="GArray"><type>GArray</type></link> should be zero-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GCutProcess"><type>GCutProcess</type></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-set-flags" role="function" condition="since:1.1.5">
<title>gcut_process_set_flags ()</title>
<indexterm zone="gcut-process-set-flags" role="1.1.5"><primary>gcut_process_set_flags</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                gcut_process_set_flags              (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GSpawnFlags"><type>GSpawnFlags</type></link> flags</parameter>);</programlisting>
<para>
Sets <parameter>flags</parameter> for spawning.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&#160;:</term>
<listitem><simpara>the flags to be passed to <link linkend="g-spawn-async-with-pipes"><function>g_spawn_async_with_pipes()</function></link>.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-flags" role="function" condition="since:1.1.5">
<title>gcut_process_get_flags ()</title>
<indexterm zone="gcut-process-get-flags" role="1.1.5"><primary>gcut_process_get_flags</primary></indexterm>
<programlisting><link linkend="GSpawnFlags"><returnvalue>GSpawnFlags</returnvalue></link>         gcut_process_get_flags              (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets <parameter>flags</parameter> for spawning.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the flags for spawning.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-set-env" role="function" condition="since:1.1.5">
<title>gcut_process_set_env ()</title>
<indexterm zone="gcut-process-set-env" role="1.1.5"><primary>gcut_process_set_env</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                gcut_process_set_env                (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *name</parameter>,
                                                         <parameter>...</parameter>);</programlisting>
<para>
Sets environment variable for external command.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&#160;:</term>
<listitem><simpara>the first environment name.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara>the value of <parameter>name</parameter>, followed by name and value
pairs. <link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-env" role="function" condition="since:1.1.5">
<title>gcut_process_get_env ()</title>
<indexterm zone="gcut-process-get-env" role="1.1.5"><primary>gcut_process_get_env</primary></indexterm>
<programlisting><link linkend="gchar"><returnvalue>gchar</returnvalue></link> **            gcut_process_get_env                (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets environment variable for external command.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly-allocated <link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated environment
variables. ("NAME1=VALUE1", "NAME2=VALUE2",
..., <link linkend="NULL:CAPS"><literal>NULL</literal></link>) It should be freed by <link linkend="g-strfreev"><function>g_strfreev()</function></link> when no longer
needed.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-run" role="function" condition="since:1.1.5">
<title>gcut_process_run ()</title>
<indexterm zone="gcut-process-run" role="1.1.5"><primary>gcut_process_run</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            gcut_process_run                    (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>
Runs a new external process.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> on success, otherwise <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-pid" role="function" condition="since:1.1.5">
<title>gcut_process_get_pid ()</title>
<indexterm zone="gcut-process-get-pid" role="1.1.5"><primary>gcut_process_get_pid</primary></indexterm>
<programlisting><link linkend="GPid"><returnvalue>GPid</returnvalue></link>                gcut_process_get_pid                (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets the process ID of running external process. If
external process isn't running, 0 is returned.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the process ID of running external process if
external process is running, otherwise 0.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-wait" role="function" condition="since:1.1.5">
<title>gcut_process_wait ()</title>
<indexterm zone="gcut-process-wait" role="1.1.5"><primary>gcut_process_wait</primary></indexterm>
<programlisting><link linkend="gint"><returnvalue>gint</returnvalue></link>                gcut_process_wait                   (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="guint"><type>guint</type></link> timeout</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>
Waits running external process is finished while <parameter>timeout</parameter>
milliseconds. If external process isn't finished while
<parameter>timeout</parameter> milliseconds, <link linkend="GCUT-PROCESS-ERROR-TIMEOUT:CAPS"><literal>GCUT_PROCESS_ERROR_TIMEOUT</literal></link> error is
set and -1 is returned. If external process isn't
running, <link linkend="GCUT-PROCESS-ERROR-NOT-RUNNING:CAPS"><literal>GCUT_PROCESS_ERROR_NOT_RUNNING</literal></link> error is set and -1
is returned.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>timeout</parameter>&#160;:</term>
<listitem><simpara>the timeout period in milliseconds
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> an exit status of external process on success,
otherwise -1.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-kill" role="function" condition="since:1.1.5">
<title>gcut_process_kill ()</title>
<indexterm zone="gcut-process-kill" role="1.1.5"><primary>gcut_process_kill</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            gcut_process_kill                   (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="gint"><type>gint</type></link> signal_number</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>
Sends <parameter>signal_number</parameter> signal to external process.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>signal_number</parameter>&#160;:</term>
<listitem><simpara>the signal number to be sent to external process
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> on success, otherwise <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-write" role="function" condition="since:1.1.5">
<title>gcut_process_write ()</title>
<indexterm zone="gcut-process-write" role="1.1.5"><primary>gcut_process_write</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            gcut_process_write                  (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *chunk</parameter>,
                                                         <parameter><link linkend="gsize"><type>gsize</type></link> size</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>
Writes <parameter>chunk</parameter> to external process's standard input.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>chunk</parameter>&#160;:</term>
<listitem><simpara>the data to be wrote
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>size</parameter>&#160;:</term>
<listitem><simpara>the size of <parameter>chunk</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> on success, otherwise <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-flush" role="function" condition="since:1.1.5">
<title>gcut_process_flush ()</title>
<indexterm zone="gcut-process-flush" role="1.1.5"><primary>gcut_process_flush</primary></indexterm>
<programlisting><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>           gcut_process_flush                  (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>
Flush buffered external process's standard input.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the status of the operation: One of
         <link linkend="G-IO-STATUS-NORMAL:CAPS"><literal>G_IO_STATUS_NORMAL</literal></link>, <link linkend="G-IO-STATUS-AGAIN:CAPS"><literal>G_IO_STATUS_AGAIN</literal></link>, or
         <link linkend="G-IO-STATUS-ERROR:CAPS"><literal>G_IO_STATUS_ERROR</literal></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-output-string" role="function" condition="since:1.1.5">
<title>gcut_process_get_output_string ()</title>
<indexterm zone="gcut-process-get-output-string" role="1.1.5"><primary>gcut_process_get_output_string</primary></indexterm>
<programlisting><link linkend="GString"><returnvalue>GString</returnvalue></link> *           gcut_process_get_output_string      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GString"><type>GString</type></link> that has all result of standard
output of external process.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-error-string" role="function" condition="since:1.1.5">
<title>gcut_process_get_error_string ()</title>
<indexterm zone="gcut-process-get-error-string" role="1.1.5"><primary>gcut_process_get_error_string</primary></indexterm>
<programlisting><link linkend="GString"><returnvalue>GString</returnvalue></link> *           gcut_process_get_error_string       (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GString"><type>GString</type></link> that has all result of standard
error of external process.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-input-channel" role="function" condition="since:1.1.5">
<title>gcut_process_get_input_channel ()</title>
<indexterm zone="gcut-process-get-input-channel" role="1.1.5"><primary>gcut_process_get_input_channel</primary></indexterm>
<programlisting><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link> *        gcut_process_get_input_channel      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets a <link linkend="GIOChannel"><type>GIOChannel</type></link> connected with standard input of
external process.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GIOChannel"><type>GIOChannel</type></link> if external process is running,
otherwise <link linkend="NULL:CAPS"><literal>NULL</literal></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-output-channel" role="function" condition="since:1.1.5">
<title>gcut_process_get_output_channel ()</title>
<indexterm zone="gcut-process-get-output-channel" role="1.1.5"><primary>gcut_process_get_output_channel</primary></indexterm>
<programlisting><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link> *        gcut_process_get_output_channel     (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets a <link linkend="GIOChannel"><type>GIOChannel</type></link> connected with standard output of
external process.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GIOChannel"><type>GIOChannel</type></link> if external process is running,
otherwise <link linkend="NULL:CAPS"><literal>NULL</literal></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-error-channel" role="function" condition="since:1.1.5">
<title>gcut_process_get_error_channel ()</title>
<indexterm zone="gcut-process-get-error-channel" role="1.1.5"><primary>gcut_process_get_error_channel</primary></indexterm>
<programlisting><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link> *        gcut_process_get_error_channel      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets a <link linkend="GIOChannel"><type>GIOChannel</type></link> connected with standard error output
of external process.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GIOChannel"><type>GIOChannel</type></link> if external process is running,
otherwise <link linkend="NULL:CAPS"><literal>NULL</literal></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-output-stream" role="function" condition="since:1.1.5">
<title>gcut_process_get_output_stream ()</title>
<indexterm zone="gcut-process-get-output-stream" role="1.1.5"><primary>gcut_process_get_output_stream</primary></indexterm>
<programlisting><link linkend="GInputStream"><returnvalue>GInputStream</returnvalue></link> *      gcut_process_get_output_stream      (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets a <link linkend="GInputStream"><type>GInputStream</type></link> connected with standard output of
external process.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GInputStream"><type>GInputStream</type></link> if external process is running,
otherwise <link linkend="NULL:CAPS"><literal>NULL</literal></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-error-stream" role="function" condition="since:1.1.5">
<title>gcut_process_get_error_stream ()</title>
<indexterm zone="gcut-process-get-error-stream" role="1.1.5"><primary>gcut_process_get_error_stream</primary></indexterm>
<programlisting><link linkend="GInputStream"><returnvalue>GInputStream</returnvalue></link> *      gcut_process_get_error_stream       (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets a <link linkend="GInputStream"><type>GInputStream</type></link> connected with standard error output
of external process.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GInputStream"><type>GInputStream</type></link> if external process is running,
otherwise <link linkend="NULL:CAPS"><literal>NULL</literal></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-forced-termination-wait-time" role="function" condition="since:1.1.5">
<title>gcut_process_get_forced_termination_wait_time ()</title>
<indexterm zone="gcut-process-get-forced-termination-wait-time" role="1.1.5"><primary>gcut_process_get_forced_termination_wait_time</primary></indexterm>
<programlisting><link linkend="guint"><returnvalue>guint</returnvalue></link>               gcut_process_get_forced_termination_wait_time
                                                        (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets a wait time in milliseconds for forced termination
on dispose.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a timeout value for waiting forced terminated
external command on dispose.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-set-forced-termination-wait-time" role="function" condition="since:1.1.5">
<title>gcut_process_set_forced_termination_wait_time ()</title>
<indexterm zone="gcut-process-set-forced-termination-wait-time" role="1.1.5"><primary>gcut_process_set_forced_termination_wait_time</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                gcut_process_set_forced_termination_wait_time
                                                        (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="guint"><type>guint</type></link> timeout</parameter>);</programlisting>
<para>
Sets a wait time in milliseconds for forced termination
on dispose. If <parameter>timeout</parameter> is 0, it doesn't wait
termination of external process. The default value is 10.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>timeout</parameter>&#160;:</term>
<listitem><simpara>the timeout value in milliseconds
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
<refsect2 id="gcut-process-get-event-loop" role="function" condition="since:1.1.6">
<title>gcut_process_get_event_loop ()</title>
<indexterm zone="gcut-process-get-event-loop" role="1.1.6"><primary>gcut_process_get_event_loop</primary></indexterm>
<programlisting><link linkend="GCutEventLoop"><returnvalue>GCutEventLoop</returnvalue></link> *     gcut_process_get_event_loop         (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>);</programlisting>
<para>
Gets a event loop using by the <parameter>process</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GCutEventLoop"><type>GCutEventLoop</type></link>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.6</para></refsect2>
<refsect2 id="gcut-process-set-event-loop" role="function" condition="since:1.1.6">
<title>gcut_process_set_event_loop ()</title>
<indexterm zone="gcut-process-set-event-loop" role="1.1.6"><primary>gcut_process_set_event_loop</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                gcut_process_set_event_loop         (<parameter><link linkend="GCutProcess"><type>GCutProcess</type></link> *process</parameter>,
                                                         <parameter><link linkend="GCutEventLoop"><type>GCutEventLoop</type></link> *loop</parameter>);</programlisting>
<para>
Sets a event loop for the <parameter>process</parameter>. If <parameter>loop</parameter> is <link linkend="NULL:CAPS"><literal>NULL</literal></link>,
the default GLib event loop will be used.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GCutProcess"><type>GCutProcess</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>loop</parameter>&#160;:</term>
<listitem><simpara>the event loop or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.6</para></refsect2>

</refsect1>
<refsect1 id="GCutProcess.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GCutProcess--command" role="property"><title>The <literal>&quot;command&quot;</literal> property</title>
<indexterm zone="GCutProcess--command"><primary>GCutProcess:command</primary></indexterm>
<programlisting>  &quot;command&quot;                  <link linkend="gpointer"><type>gpointer</type></link>              : Read / Write</programlisting>
<para>The command to be ran by the process.</para></refsect2>
</refsect1>
<refsect1 id="GCutProcess.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GCutProcess-error" role="signal"><title>The <literal>&quot;error&quot;</literal> signal</title>
<indexterm zone="GCutProcess-error" role="1.1.5"><primary>GCutProcess::error</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                user_function                      (<link linkend="GCutProcess"><type>GCutProcess</type></link> *process,
                                                        <link linkend="gpointer"><type>gpointer</type></link>     error,
                                                        <link linkend="gpointer"><type>gpointer</type></link>     user_data)      : Run Last</programlisting>
<para>
It is emitted each time an external process causes an
error. (e.g. IO error)
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>the object which received the signal.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara>the error of an external process. (<link linkend="GError"><literal>GError</literal></link>)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2><refsect2 id="GCutProcess-error-received" role="signal"><title>The <literal>&quot;error-received&quot;</literal> signal</title>
<indexterm zone="GCutProcess-error-received" role="1.1.5"><primary>GCutProcess::error-received</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                user_function                      (<link linkend="GCutProcess"><type>GCutProcess</type></link> *process,
                                                        <link linkend="gchar"><type>gchar</type></link>       *chunk,
                                                        <link linkend="guint64"><type>guint64</type></link>      size,
                                                        <link linkend="gpointer"><type>gpointer</type></link>     user_data)      : Run Last</programlisting>
<para>
It is emitted each time an external process outputs
something to its standard error output and it is
read.
</para>
<para>
Note that you need to run GLib's main loop by
<link linkend="g-main-loop-run"><function>g_main_loop_run()</function></link>, <link linkend="g-main-context-iteration"><function>g_main_context_iteration()</function></link> and so
on for detecting an external process's output is
readable.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>the object which received the signal.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>chunk</parameter>&#160;:</term>
<listitem><simpara>the chunk read from an external process's
        standard error output.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>size</parameter>&#160;:</term>
<listitem><simpara>the size of <parameter>chunk</parameter>. (<link linkend="gsize"><literal>gsize</literal></link>)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2><refsect2 id="GCutProcess-output-received" role="signal"><title>The <literal>&quot;output-received&quot;</literal> signal</title>
<indexterm zone="GCutProcess-output-received" role="1.1.5"><primary>GCutProcess::output-received</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                user_function                      (<link linkend="GCutProcess"><type>GCutProcess</type></link> *process,
                                                        <link linkend="gchar"><type>gchar</type></link>       *chunk,
                                                        <link linkend="guint64"><type>guint64</type></link>      size,
                                                        <link linkend="gpointer"><type>gpointer</type></link>     user_data)      : Run Last</programlisting>
<para>
It is emitted each time an external process outputs
something to its standard output and it is read.
</para>
<para>
Note that you need to run GLib's main loop by
<link linkend="g-main-loop-run"><function>g_main_loop_run()</function></link>, <link linkend="g-main-context-iteration"><function>g_main_context_iteration()</function></link> and so
on for detecting an external process's output is
readable.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>the object which received the signal.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>chunk</parameter>&#160;:</term>
<listitem><simpara>the chunk read from an external process's
        standard output.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>size</parameter>&#160;:</term>
<listitem><simpara>the size of <parameter>chunk</parameter>. (<link linkend="gsize"><literal>gsize</literal></link>)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2><refsect2 id="GCutProcess-reaped" role="signal"><title>The <literal>&quot;reaped&quot;</literal> signal</title>
<indexterm zone="GCutProcess-reaped" role="1.1.5"><primary>GCutProcess::reaped</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                user_function                      (<link linkend="GCutProcess"><type>GCutProcess</type></link> *process,
                                                        <link linkend="gint"><type>gint</type></link>         status,
                                                        <link linkend="gpointer"><type>gpointer</type></link>     user_data)      : Run Last</programlisting>
<para>
It is emitted when an external process is exited.
</para>
<para>
Note that you need to run GLib's main loop by
<link linkend="g-main-loop-run"><function>g_main_loop_run()</function></link>, <link linkend="g-main-context-iteration"><function>g_main_context_iteration()</function></link> and so
on for detecting an external process is exited.
</para><variablelist role="params">
<varlistentry><term><parameter>process</parameter>&#160;:</term>
<listitem><simpara>the object which received the signal.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>status</parameter>&#160;:</term>
<listitem><simpara>the exit status of an external process.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.1.5</para></refsect2>
</refsect1>

</refentry>
