[2020-02] Avoid following invalid pointers in mono_w32process_get_modules on Darwin...
[mono-project.git] / mono / tests / process2.cs
blob25137e2762c7e228d1d0c257a325864c56ff87de
1 using System;
2 using System.Diagnostics;
3 using System.Threading;
5 class Modules {
6 static void Run() {
7 Process proc = new Process();
8 bool ret;
10 proc.StartInfo.FileName="wibble-redir";
11 proc.StartInfo.Arguments="arg1 arg2\targ3 \"arg4a arg4b\"";
12 proc.StartInfo.UseShellExecute=false;
13 proc.StartInfo.RedirectStandardInput=true;
14 ret=proc.Start();
16 Console.WriteLine("Start returns " + ret);
17 Console.WriteLine("Process is " + proc.ToString());
18 Console.WriteLine("Pid is " + proc.Id);
19 Console.WriteLine("Handle is " + proc.Handle);
20 Console.WriteLine("HandleCount is " + proc.HandleCount);
22 Console.WriteLine("Writing [foo bar]");
23 proc.StandardInput.WriteLine("foo bar");
25 System.Threading.Thread.Sleep(1000);
27 Console.WriteLine("Writing [wibble wobble]");
28 proc.StandardInput.WriteLine("wibble wobble");
30 System.Threading.Thread.Sleep(1000);
32 Console.WriteLine("Closing stdin");
33 proc.StandardInput.Close();
35 Console.WriteLine("Waiting for exit...");
36 proc.WaitForExit();
37 Console.WriteLine("Wait returned");
38 Console.WriteLine("Exit code is " + proc.ExitCode);
39 Console.WriteLine("Process started at " + proc.StartTime);
40 Console.WriteLine("Process ended at " + proc.ExitTime);
43 static void Main() {
44 Run();