From 5e6788c679c4f9c86a847e65d43a395c32912bf7 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 15 Feb 2024 22:27:32 +0900 Subject: Export FZF_* variables to 'reload' process as well --- src/core.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/core.go') diff --git a/src/core.go b/src/core.go index ed56a879..56a2198e 100644 --- a/src/core.go +++ b/src/core.go @@ -213,6 +213,7 @@ func Run(opts *Options, version string, revision string) { reading := true ticks := 0 var nextCommand *string + var nextEnviron []string eventBox.Watch(EvtReadNew) total := 0 query := []rune{} @@ -232,13 +233,13 @@ func Run(opts *Options, version string, revision string) { useSnapshot := false var snapshot []*Chunk var count int - restart := func(command string) { + restart := func(command string, environ []string) { reading = true chunkList.Clear() itemIndex = 0 inputRevision++ header = make([]string, 0, opts.HeaderLines) - go reader.restart(command) + go reader.restart(command, environ) } for { delay := true @@ -266,8 +267,9 @@ func Run(opts *Options, version string, revision string) { os.Exit(value.(int)) case EvtReadNew, EvtReadFin: if evt == EvtReadFin && nextCommand != nil { - restart(*nextCommand) + restart(*nextCommand, nextEnviron) nextCommand = nil + nextEnviron = nil break } else { reading = reading && evt == EvtReadNew @@ -292,11 +294,13 @@ func Run(opts *Options, version string, revision string) { case EvtSearchNew: var command *string + var environ []string var changed bool switch val := value.(type) { case searchRequest: sort = val.sort command = val.command + environ = val.environ changed = val.changed if command != nil { useSnapshot = val.sync @@ -306,8 +310,9 @@ func Run(opts *Options, version string, revision string) { if reading { reader.terminate() nextCommand = command + nextEnviron = environ } else { - restart(*command) + restart(*command, environ) } } if !changed { -- cgit v1.2.3