mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
fix: wait for command to complete
without wait(), the *ProcessState is nil, meaning we can't access the ExitCode(). On Windows, calling wait() introduces a timeout which makes things run slower, which is why we only call wait() in case of an error. That should not be the main use-case. relates to #285
This commit is contained in:
parent
7e7483501c
commit
d9d2430ae9
|
@ -201,6 +201,9 @@ func (env *environment) runCommand(command string, args ...string) (string, erro
|
|||
stdoutString := getOutputString(stdout)
|
||||
stderrString := getOutputString(stderr)
|
||||
if stderrString != "" {
|
||||
// only wait in case of error reduces the lead time on successful
|
||||
// commands on windows due to not calling process.Wait()
|
||||
_ = cmd.Wait()
|
||||
return "", &commandError{
|
||||
err: stderrString,
|
||||
exitCode: cmd.ProcessState.ExitCode(),
|
||||
|
|
Loading…
Reference in a new issue