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
+58-24Lines changed: 58 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,57 +53,91 @@ v1.0-beta.1 - 2014-01-17
53
53
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.
54
54
55
55
```
56
-
name: The name of this instance, arbitrary
57
-
58
-
max: maximum number of processes to maintain
59
-
60
-
min: minimum number of processes to maintain
61
-
62
-
idleTimeoutMS: idle in milliseconds by which a process will be destroyed
63
-
56
+
name: The name of this instance, arbitrary
57
+
58
+
max: maximum number of processes to maintain
59
+
60
+
min: minimum number of processes to maintain
61
+
62
+
idleTimeoutMS: idle in milliseconds by which a process will be destroyed
63
+
64
64
processCommand: full path to the actual process to be spawned (i.e. /bin/bash)
65
-
65
+
66
66
processArgs: arguments to pass to the process command
67
-
68
-
processRetainMaxCmdHistory: default 0, for each process spawned, the maximum number
67
+
68
+
processRetainMaxCmdHistory: for each process spawned, the maximum number
69
69
of command history objects to retain in memory
70
-
(useful for debugging via the getStatus() method)
71
-
70
+
(useful for debugging), default 0
71
+
72
72
processInvalidateOnRegex: optional config of regex patterns who if match
73
73
their respective type, will flag the process as invalid
74
-
75
74
{
76
75
'any' : ['regex1', ....],
77
76
'stdout' : ['regex1', ....],
78
77
'stderr' : ['regex1', ....]
79
78
}
80
-
79
+
80
+
processCmdBlacklistRegex: optional config array regex patterns who if match the
81
+
command requested to be executed will be rejected
82
+
with an error
83
+
[ 'regex1', 'regex2'...]
84
+
81
85
processCwd: optional current working directory for the processes to be spawned
82
-
86
+
83
87
processEnvMap: optional hash/object of key-value pairs for environment variables
84
88
to set for the spawned processes
85
-
89
+
86
90
processUid: optional uid to launch the processes as
87
-
91
+
88
92
processGid: optional gid to launch the processes as
89
-
93
+
90
94
logFunction: optional function that should have the signature
91
95
(severity,origin,message), where log messages will
92
96
be sent to. If null, logs will just go to console
93
-
97
+
94
98
initCommands: optional array of actual commands to execute on each newly
95
99
spawned ProcessProxy in the pool before it is made available
96
-
100
+
97
101
preDestroyCommands: optional array of actual commands to execute on a process
98
102
before it is killed/destroyed on shutdown or being invalid
99
-
103
+
100
104
validateFunction: optional function that should have the signature to accept
101
105
a ProcessProxy object, and should return true/false if the
102
106
process is valid or not, at a minimum this should call
103
107
ProcessProxy.isValid(). If the function is not provided
104
108
the default behavior is to only check ProcessProxy.isValid()
105
-
which is sufficient for most use cases if 'processInvalidateOnRegex'
106
-
is properly configured
109
+
110
+
autoInvalidationConfig optional configuration that will run the specified
111
+
commands in the background on the given interval,
112
+
and if the given regexes match/do-not-match for each command the
113
+
ProcessProxy will be flagged as invalid and return FALSE
114
+
on calls to isValid(). The commands will be run in
115
+
order sequentially via executeCommands()
116
+
{
117
+
checkIntervalMS: 30000; // check every 30s
118
+
commands:
119
+
[
120
+
{ command:'cmd1toRun',
121
+
122
+
// OPTIONAL: because you can configure multiple commands
123
+
// where the first ones doe some prep, then the last one's
124
+
// output needs to be evaluated hence 'regexes' may not
125
+
// always be present, (but your LAST command must have a
126
+
// regexes config to eval prior work, otherwise whats the point
0 commit comments