You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60-2Lines changed: 60 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,16 +13,74 @@ Simply doing an child_process.**exec** per command to launch an external process
13
13
14
14
The diagram below should conceptually give you an idea of what this module does.
15
15
16
-
**The local user that the node process runs as should have virtually zero rights! Also be sure to properly configure a restricted UID/GID when instatiating a new instance of this**
16
+
**The local user that the node process runs as should have virtually zero rights! Also be sure to properly configure a restricted UID/GID when instatiating a new instance of this. See security notes below.**
17
17
18
18

19
19
20
20
### Usage
21
21
22
-
Its highly recommended you check out the unit-tests for some examples in addition to the below:
22
+
To use StatefulProcessCommandProxy the constructor takes one parameter which is a configuration object who's properties are described below. Please refer to the example (following) and the unit-test for more details.
23
+
24
+
```
25
+
name: The name of this instance, arbitrary
26
+
27
+
max: maximum number of processes to maintain
28
+
29
+
min: minimum number of processes to maintain
30
+
31
+
idleTimeoutMS: idle in milliseconds by which a process will be destroyed
32
+
33
+
processCommand: full path to the actual process to be spawned (i.e. /bin/bash)
34
+
35
+
processArgs: arguments to pass to the process command
36
+
37
+
processRetainMaxCmdHistory: default 0, for each process spawned, the maximum number
38
+
of command history objects to retain in memory
39
+
(useful for debugging via the getStatus() method)
40
+
41
+
processInvalidateOnRegex: optional config of regex patterns who if match
42
+
their respective type, will flag the process as invalid
43
+
44
+
{
45
+
'any' : ['regex1', ....],
46
+
'stdout' : ['regex1', ....],
47
+
'stderr' : ['regex1', ....]
48
+
}
49
+
50
+
processCwd: optional current working directory for the processes to be spawned
23
51
52
+
processEnvMap: optional hash/object of key-value pairs for environment variables
53
+
to set for the spawned processes
54
+
55
+
processUid: optional uid to launch the processes as
56
+
57
+
processGid: optional gid to launch the processes as
58
+
59
+
logFunction: optional function that should have the signature
60
+
(severity,origin,message), where log messages will
61
+
be sent to. If null, logs will just go to console
62
+
63
+
initCommands: optional array of actual commands to execute on each newly
64
+
spawned ProcessProxy in the pool before it is made available
65
+
66
+
preDestroyCommands: optional array of actual commands to execute on a process
67
+
before it is killed/destroyed on shutdown or being invalid
68
+
69
+
validateFunction: optional function that should have the signature to accept
70
+
a ProcessProxy object, and should return true/false if the
71
+
process is valid or not, at a minimum this should call
72
+
ProcessProxy.isValid(). If the function is not provided
73
+
the default behavior is to only check ProcessProxy.isValid()
74
+
which is sufficient for most use cases if 'processInvalidateOnRegex'
75
+
is properly configured
76
+
```
77
+
78
+
Its highly recommended you check out the unit-tests for some examples in addition to the below:
24
79
25
80
### Example
81
+
82
+
Note this example is for a machine w/ bash in the typical location. Windows (or other) can adjust the below as necessary to run).
0 commit comments