1
2
3
4
5
6 using System.Collections;
7
8 namespace System
9 {
10 public Result<bool> Execute(const string& command)
11 {
12 int errorId = RtmExecute(command.Chars());
13 if (errorId != 0)
14 {
15 return Result<bool>(ErrorId(errorId));
16 }
17 return Result<bool>(true);
18 }
19
20 public int Execute(const string& command, const List<Pair<int, string>>& redirections)
21 {
22 int execHandle = RtmBeginExec(command.Chars());
23 for (const Pair<int, string>& redirection : redirections)
24 {
25 int handle = redirection.first;
26 const string& file = redirection.second;
27 RtmAddRedirection(execHandle, handle, file.Chars());
28 }
29 return RtmEndExec(execHandle);
30 }
31
32 public string GetPathToExecutable()
33 {
34 int pathHandle = RtmBeginGetPathToExecutable();
35 string pathToExecutable = RtmGetPathToExecutable(pathHandle);
36 RtmEndGetPathToExecutable(pathHandle);
37 return pathToExecutable;
38 }