Skip to content

Commit

Permalink
fix #250: is_elevated doesn't ask for pass when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
F1bonacc1 committed Sep 26, 2024
1 parent 3f53128 commit 64430a6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/app/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,16 @@ func (p *Process) handleOutput(pipe io.ReadCloser, output string, handler func(m
p.procState.Health = types.ProcessHealthReady
p.readyLogCancelFn(nil)
}
if p.procConf.IsElevated &&
!p.passProvided &&
p.waitForPassCancelFn != nil {
p.checkElevatedProcOutput(line)
handler(strings.TrimSuffix(line, "\n"))
}
close(done)
}

func (p *Process) checkElevatedProcOutput(line string) {
if p.procConf.IsElevated &&
!p.passProvided {
if p.waitForPassCancelFn != nil {
if isWrongPasswordEntered(line) {
log.Warn().
Str("process", p.getName()).
Expand All @@ -605,10 +612,10 @@ func (p *Process) handleOutput(pipe io.ReadCloser, output string, handler func(m
}
p.waitForPassCancelFn()
p.waitForPassCancelFn = nil
} else {
p.passProvided = true
}
handler(strings.TrimSuffix(line, "\n"))
}
close(done)
}

func (p *Process) handleInfo(message string) {
Expand Down

0 comments on commit 64430a6

Please sign in to comment.