Minor refactoring

This commit is contained in:
Junegunn Choi 2024-07-27 18:58:23 +09:00
parent 587df594b8
commit b99d884e57
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -148,19 +148,21 @@ func Run(opts *Options) (int, error) {
// Terminal I/O
var terminal *Terminal
var err error
var initialEnv []string
initialReload := opts.extractReloadOnStart()
if opts.Filter == nil {
var err error
terminal, err = NewTerminal(opts, eventBox, executor)
if err != nil {
return ExitError, err
}
initialEnv = terminal.environ()
if len(initialReload) > 0 {
var temps []string
initialReload, temps = terminal.replacePlaceholderInInitialCommand(initialReload)
initialEnv = terminal.environ()
defer removeFiles(temps)
}
}
// Reader
streamingFilter := opts.Filter != nil && !sort && !opts.Tac && !opts.Sync