1
2
3
4
5
6 #include <soulng/util/Process.hpp>
7 #include <soulng/util/ProcessImpl.hpp>
8 #ifdef _WIN32
9 #include <Windows.h>
10 #else
11 #include <sys/types.h>
12 #include <unistd.h>
13 #endif
14
15 namespace soulng { namespace util {
16
17 Process::Process(const std::string& command, Redirections redirections) : impl(new ProcessImpl(command, redirections))
18 {
19 }
20
21 Process::~Process()
22 {
23 delete impl;
24 }
25
26 bool Process::Running()
27 {
28 return impl->Running();
29 }
30
31 void Process::WaitForExit()
32 {
33 impl->WaitForExit();
34 }
35
36 int Process::ExitCode() const
37 {
38 return impl->ExitCode();
39 }
40
41 void Process::Terminate()
42 {
43 impl->Terminate();
44 }
45
46 bool Process::Eof(StdHandle handle)
47 {
48 return impl->Eof(handle);
49 }
50
51 std::string Process::ReadLine(StdHandle handle)
52 {
53 return impl->ReadLine(handle);
54 }
55
56 std::string Process::ReadToEnd(StdHandle handle)
57 {
58 return impl->ReadToEnd(handle);
59 }
60
61 void Process::WriteLine(const std::string& line)
62 {
63 impl->WriteLine(line);
64 }
65
66 int GetPid()
67 {
68 #ifdef _WIN32
69
70 #else
71 return getpid();
72 #endif
73 }
74
75 } }