blob: 485daaf6780ef805da17a76238d42779ea04917f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
//
//
// The Nimrod Compiler
// (c) Copyright 2009 Andreas Rumpf
//
// See the file "copying.txt", included in this
// distribution, for details about the copyright.
//
unit osproc;
// This module provides Nimrod's osproc module in Pascal
// Note: Only implement what is really needed here!
interface
{$include 'config.inc'}
uses
nsystem, nos;
type
TProcessOption = (poEchoCmd, poUseShell, poStdErrToStdOut, poParentStreams);
TProcessOptions = set of TProcessOption;
function execCmd(const cmd: string): int;
function execProcesses(const cmds: array of string;
options: TProcessOptions;
n: int): int;
function countProcessors(): int;
implementation
function execCmd(const cmd: string): int;
begin
writeln(output, cmd);
result := executeShellCommand(cmd);
end;
function execProcesses(const cmds: array of string;
options: TProcessOptions;
n: int): int;
var
i: int;
begin
result := 0;
for i := 0 to high(cmds) do begin
//if poEchoCmd in options then writeln(output, cmds[i]);
result := max(result, execCmd(cmds[i]))
end
end;
function countProcessors(): int;
begin
result := 1;
end;
end.
|