[Gtk-sharp-list] spawning apps

Glenn Pierce glennpierce@connectfree.co.uk
19 Sep 2002 15:27:08 +0000


--=-S5FidxeZ+1sGf2CYiQeH
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


That does not work for me the program just returns.
I have also tried.

 ProcessStartInfo processInfo = new ProcessStartInfo("gedit");
 processInfo.UseShellExecute = false;
 processInfo.RedirectStandardOutput = true;
 Process process = Process.Start(processInfo);

without luck.

On Thu, 2002-09-19 at 14:08, Duncan Mak wrote:

    On Thu, 2002-09-19 at 09:08, Glenn Pierce wrote:
    > Currently I am doing something like this 
    > 
    > [DllImport("glib-2.0")] 
    >          static extern bool g_spawn_command_line_sync (string command,
    > string[] std_out, string[] std_err, int exit_status, IntPtr err); 
    > 
    
    Have you tried using the Process class? You can spawn a command like
    this:
    
    using System.Diagnostics;
    
    static void Main (string [] args)
    {
    	string command = args [0];
    	
    	Process p = new Process ();
    	p.StartInfo.FileName = command;
    	p.Start ();
    
    	...
    }
    
    -- 
    Duncan Mak <duncan@ximian.com>
    

_____________________________

_____________________________

--=-S5FidxeZ+1sGf2CYiQeH
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/1.0.4">
</HEAD>
<BODY>

<BR>
That does not work for me the program just returns.
<BR>
I have also tried.
<BR>

<BR>
 ProcessStartInfo processInfo = new ProcessStartInfo(&quot;gedit&quot;);
<BR>
 processInfo.UseShellExecute = false;
<BR>
 processInfo.RedirectStandardOutput = true;
<BR>
 Process process = Process.Start(processInfo);
<BR>

<BR>
without luck.
<BR>

<BR>
On Thu, 2002-09-19 at 14:08, Duncan Mak wrote:
    <BLOCKQUOTE>
<PRE><FONT COLOR="#737373"><FONT SIZE="3"><I>On Thu, 2002-09-19 at 09:08, Glenn Pierce wrote:</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; Currently I am doing something like this </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; [DllImport(&quot;glib-2.0&quot;)] </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt;          static extern bool g_spawn_command_line_sync (string command,</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; string[] std_out, string[] std_err, int exit_status, IntPtr err); </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>Have you tried using the Process class? You can spawn a command like</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>this:</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>using System.Diagnostics;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>static void Main (string [] args)</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>{</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>	string command = args [0];</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>	</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>	Process p = new Process ();</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>	p.StartInfo.FileName = command;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>	p.Start ();</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>	...</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>}</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>-- </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>Duncan Mak &lt;duncan@ximian.com&gt;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I></PRE>
    </BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<FONT COLOR="#6c51e8">_____________________________</FONT>
<BR>
<A HREF="mailto:glennpierce@connectree.co.uk"><FONT COLOR="#808080"><FONT SIZE="2"></FONT></FONT></A>
<BR>
<FONT COLOR="#6c51e8">_____________________________</FONT>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

--=-S5FidxeZ+1sGf2CYiQeH--