MCPcopy
hub / github.com/lmorg/murex / executeProcess

Function executeProcess

lang/process.go:218–417  ·  view source on GitHub ↗
(p *Process)

Source from the content-addressed store, hash-verified

216}
217
218func executeProcess(p *Process) {
219 defer crash.Handler()
220
221 testStates(p)
222
223 if p.HasTerminated() || p.HasCancelled() ||
224 /*p.Parent.HasTerminated() ||*/ p.Parent.HasCancelled() {
225 destroyProcess(p)
226 return
227 }
228
229 p.State.Set(state.Starting)
230
231 var err error
232 name := p.Name.String()
233 echo, err := p.Config.Get("proc", "echo", types.Boolean)
234 if err != nil {
235 echo = false
236 }
237
238 tmux, err := p.Config.Get("proc", "echo-tmux", types.Boolean)
239 if err != nil {
240 tmux = false
241 }
242
243 var parsedAlias bool
244
245 n, params, err := ParseStatementParameters(p.raw, p)
246 if err != nil {
247 goto cleanUpProcess
248 }
249 if n != name {
250 p.Name.Set(n)
251 name = n
252 }
253 p.Parameters.DefineParsed(params)
254
255 // Execute function
256 p.StartTime = time.Now()
257
258 if p.cache != nil && p.cache.use {
259 // we have a preview cache, lets just write that and skip execution
260 _, err = p.Stdout.Write(p.cache.b.stdout)
261 if err != nil {
262 panic(err)
263 }
264 p.Stdout.SetDataType(p.cache.dt.stdout)
265
266 _, err = p.Stderr.Write(p.cache.b.stderr)
267 if err != nil {
268 panic(err)
269 }
270 p.Stderr.SetDataType(p.cache.dt.stderr)
271
272 goto cleanUpProcess
273 }
274
275executeProcess:

Callers 6

runModeNormalFunction · 0.85
runModeTryFunction · 0.85
runModeTryPipeFunction · 0.85
runModeNormalFunction · 0.85
runModeTryFunction · 0.85
runModeTryPipeFunction · 0.85

Calls 15

HandlerFunction · 0.92
TmuxFunction · 0.92
testStatesFunction · 0.85
destroyProcessFunction · 0.85
indentErrorFunction · 0.85
writeErrorFunction · 0.85
HasTerminatedMethod · 0.80
HasCancelledMethod · 0.80
DefineParsedMethod · 0.80
StringArrayMethod · 0.80
ForkMethod · 0.80
CopyFromMethod · 0.80

Tested by

no test coverage detected