Skip to content

Commit 7069b21

Browse files
committed
Add -eval-before-fork option to aid in debugging
1 parent 68fd06f commit 7069b21

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/qa/cmd/run/run.go

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func Main(env *cmd.Env, args []string) error {
7373

7474
errorsCaptureLocals := flags.String("errors-capture-locals", "false", "Use runtime debug API to capture locals from stack when raising errors")
7575
captureStandardFds := flags.Bool("capture-standard-fds", true, "Capture stdout and stderr")
76+
evalBeforeFork := flags.String("eval-before-fork", "", "Execute the given code before forking any workers or loading any files")
7677
evalAfterFork := flags.String("eval-after-fork", "", "Execute the given code after a work forks, but before work begins")
7778
sampleStack := flags.Bool("sample-stack", false, "Enable stack sampling")
7879

@@ -329,6 +330,7 @@ func Main(env *cmd.Env, args []string) error {
329330
"warmup": *warmup,
330331
"errorsCaptureLocals": *errorsCaptureLocals,
331332
"captureStandardFds": *captureStandardFds,
333+
"evalBeforeFork": *evalBeforeFork,
332334
"evalAfterFork": *evalAfterFork,
333335
"sampleStack": *sampleStack,
334336
}

src/qa/runner-assets/ruby/shared.rb

+3
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,9 @@ def main(args)
12251225
end
12261226
qa_trace.start
12271227

1228+
eval_before_fork = (passthrough['evalBeforeFork'] || '')
1229+
eval(eval_before_fork) unless eval_before_fork.empty?
1230+
12281231
# Delegate prefork actions.
12291232
@prefork.call(initial_files)
12301233

0 commit comments

Comments
 (0)