~cbehrens/openstack-guest-agents/lp764221

« back to all changes in this revision

Viewing changes to src/xenserver/windows/src/Rackspace.Cloud.Server.Agent/ProcessWrapper.cs

  • Committer: Antony Messerli
  • Date: 2011-03-02 21:56:51 UTC
  • Revision ID: amesserl@rackspace.com-20110302215651-0clqh49spumg13c6
Initial commit Rackspace Windows Guest Agent

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Diagnostics;
 
3
using System.IO;
 
4
using Rackspace.Cloud.Server.Agent.Interfaces;
 
5
 
 
6
namespace Rackspace.Cloud.Server.Agent
 
7
{
 
8
    public class ProcessWrapper : IProcessWrapper
 
9
    {
 
10
        private Process process;
 
11
 
 
12
        public ProcessWrapper() : this(true, false, true, true) { }
 
13
 
 
14
        public ProcessWrapper(bool createNoWindow, bool useShellExecute, bool redirectStandardOutput, bool redirectStandardError)
 
15
        {
 
16
            process = new Process();
 
17
            process.StartInfo.CreateNoWindow = createNoWindow;
 
18
            process.StartInfo.UseShellExecute = useShellExecute;
 
19
            process.StartInfo.RedirectStandardOutput = redirectStandardOutput;
 
20
            process.StartInfo.RedirectStandardError = redirectStandardError;
 
21
        }
 
22
 
 
23
        public string FileName
 
24
        {
 
25
            get { return process.StartInfo.FileName; }
 
26
            set { process.StartInfo.FileName = value; }
 
27
        }
 
28
        public string Arguments
 
29
        {
 
30
            get { return process.StartInfo.Arguments; }
 
31
            set { process.StartInfo.Arguments = value; }
 
32
        }
 
33
        public bool CreateNoWindow
 
34
        {
 
35
            get { return process.StartInfo.CreateNoWindow; }
 
36
        }
 
37
 
 
38
        public bool UseShellExecute
 
39
        {
 
40
            get { return process.StartInfo.UseShellExecute; }
 
41
        }
 
42
 
 
43
        public bool RedirectStandardOutput
 
44
        {
 
45
            get { return process.StartInfo.RedirectStandardOutput; }
 
46
        }
 
47
 
 
48
        public bool RedirectStandardError
 
49
        {
 
50
            get { return process.StartInfo.RedirectStandardError; }
 
51
        }
 
52
 
 
53
        public int ExitCode
 
54
        {
 
55
            get { return process.ExitCode; }
 
56
        }
 
57
 
 
58
        public bool Start()
 
59
        {
 
60
            return process.Start();
 
61
        }
 
62
 
 
63
        public void WaitForExit()
 
64
        {
 
65
            process.WaitForExit();
 
66
        }
 
67
 
 
68
        public StreamReader StandardError
 
69
        {
 
70
            get { return process.StandardError; }
 
71
        }
 
72
        public StreamReader StandardOutput
 
73
        {
 
74
            get { return process.StandardOutput; }
 
75
        }
 
76
    }
 
77
}
 
 
b'\\ No newline at end of file'