Skip to content

Commit

Permalink
Add -eval-before-fork option to aid in debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbouh committed Jul 21, 2016
1 parent 68fd06f commit 7069b21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/qa/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func Main(env *cmd.Env, args []string) error {

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

Expand Down Expand Up @@ -329,6 +330,7 @@ func Main(env *cmd.Env, args []string) error {
"warmup": *warmup,
"errorsCaptureLocals": *errorsCaptureLocals,
"captureStandardFds": *captureStandardFds,
"evalBeforeFork": *evalBeforeFork,
"evalAfterFork": *evalAfterFork,
"sampleStack": *sampleStack,
}
Expand Down
3 changes: 3 additions & 0 deletions src/qa/runner-assets/ruby/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,9 @@ def main(args)
end
qa_trace.start

eval_before_fork = (passthrough['evalBeforeFork'] || '')
eval(eval_before_fork) unless eval_before_fork.empty?

# Delegate prefork actions.
@prefork.call(initial_files)

Expand Down

0 comments on commit 7069b21

Please sign in to comment.