diff options
Diffstat (limited to 'OpenSim/Tools/OpenSim.GUI/ProcessManager.cs')
-rw-r--r-- | OpenSim/Tools/OpenSim.GUI/ProcessManager.cs | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs b/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs index 0ab074e..8c019fb 100644 --- a/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs +++ b/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs | |||
@@ -1,71 +1,71 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Diagnostics; | 4 | using System.Diagnostics; |
5 | 5 | ||
6 | namespace OpenSim.GUI | 6 | namespace OpenSim.GUI |
7 | { | 7 | { |
8 | public class ProcessManager : Process | 8 | public class ProcessManager : Process |
9 | { | 9 | { |
10 | private string m_FileName; | 10 | private string m_FileName; |
11 | private string m_Arguments; | 11 | private string m_Arguments; |
12 | public ProcessManager(string FileName,string Arguments) | 12 | public ProcessManager(string FileName,string Arguments) |
13 | { | 13 | { |
14 | m_FileName = FileName; | 14 | m_FileName = FileName; |
15 | m_Arguments = Arguments; | 15 | m_Arguments = Arguments; |
16 | 16 | ||
17 | // MyProc = new Process(); | 17 | // MyProc = new Process(); |
18 | StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; | 18 | StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; |
19 | Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory); | 19 | Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory); |
20 | StartInfo.FileName = m_FileName; | 20 | StartInfo.FileName = m_FileName; |
21 | 21 | ||
22 | //p.StartInfo.Arguments = ""; | 22 | //p.StartInfo.Arguments = ""; |
23 | StartInfo.UseShellExecute = false; | 23 | StartInfo.UseShellExecute = false; |
24 | StartInfo.RedirectStandardError = true; | 24 | StartInfo.RedirectStandardError = true; |
25 | StartInfo.RedirectStandardInput = true; | 25 | StartInfo.RedirectStandardInput = true; |
26 | StartInfo.RedirectStandardOutput = true; | 26 | StartInfo.RedirectStandardOutput = true; |
27 | StartInfo.CreateNoWindow = true; | 27 | StartInfo.CreateNoWindow = true; |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | public void StartProcess() | 33 | public void StartProcess() |
34 | { | 34 | { |
35 | try | 35 | try |
36 | { | 36 | { |
37 | Start(); | 37 | Start(); |
38 | BeginOutputReadLine(); | 38 | BeginOutputReadLine(); |
39 | BeginErrorReadLine(); | 39 | BeginErrorReadLine(); |
40 | } | 40 | } |
41 | catch (Exception ex) | 41 | catch (Exception ex) |
42 | { | 42 | { |
43 | Console.WriteLine("Exception Occurred :{0},{1}", | 43 | Console.WriteLine("Exception Occurred :{0},{1}", |
44 | ex.Message, ex.StackTrace.ToString()); | 44 | ex.Message, ex.StackTrace.ToString()); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | public void StopProcess() | 47 | public void StopProcess() |
48 | { | 48 | { |
49 | try | 49 | try |
50 | { | 50 | { |
51 | CancelErrorRead(); | 51 | CancelErrorRead(); |
52 | CancelErrorRead(); | 52 | CancelErrorRead(); |
53 | if (!HasExited) | 53 | if (!HasExited) |
54 | { | 54 | { |
55 | StandardInput.WriteLine("quit"); | 55 | StandardInput.WriteLine("quit"); |
56 | StandardInput.WriteLine("shutdown"); | 56 | StandardInput.WriteLine("shutdown"); |
57 | System.Threading.Thread.Sleep(500); | 57 | System.Threading.Thread.Sleep(500); |
58 | if (!HasExited) | 58 | if (!HasExited) |
59 | { | 59 | { |
60 | Kill(); | 60 | Kill(); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
64 | catch (Exception ex) | 64 | catch (Exception ex) |
65 | { | 65 | { |
66 | Console.WriteLine("Exception Occurred :{0},{1}", | 66 | Console.WriteLine("Exception Occurred :{0},{1}", |
67 | ex.Message, ex.StackTrace.ToString()); | 67 | ex.Message, ex.StackTrace.ToString()); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |