mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
backport of commit 7f2d3f2c5c (#20860)
Co-authored-by: Anton Averchenkov <84287187+averche@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5915737942
commit
92325ac8e3
@@ -264,7 +264,16 @@ func (s *Server) bounceCmd(newEnvVars []string) error {
|
||||
}
|
||||
s.childProcess = proc
|
||||
|
||||
// listen if the child process exits and bubble it up to the main loop
|
||||
if err := s.childProcess.Start(); err != nil {
|
||||
return fmt.Errorf("error starting the child process: %w", err)
|
||||
}
|
||||
|
||||
s.childProcessState = childProcessStateRunning
|
||||
|
||||
// Listen if the child process exits and bubble it up to the main loop.
|
||||
//
|
||||
// NOTE: this must be invoked after child.Start() to avoid a potential
|
||||
// race condition with ExitCh not being initialized.
|
||||
go func() {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
s.childProcessExitCodeCloser = cancel
|
||||
@@ -277,10 +286,5 @@ func (s *Server) bounceCmd(newEnvVars []string) error {
|
||||
}
|
||||
}()
|
||||
|
||||
if err := s.childProcess.Start(); err != nil {
|
||||
return fmt.Errorf("error starting child process: %w", err)
|
||||
}
|
||||
s.childProcessState = childProcessStateRunning
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user