Skip to content

Commit

Permalink
Moved progress declaration into for loop (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
RedStylzZ authored Sep 4, 2024
1 parent 5c4bceb commit 282fbd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ func (s *Scanner) Run() (result *Run, warnings *[]string, err error) {
type progress struct {
TaskProgress []TaskProgress `xml:"taskprogress" json:"task_progress"`
}
p := &progress{}
for {
select {
case <-doneProgress:
close(s.liveProgress)
return
default:
time.Sleep(time.Millisecond * 100)
_ = xml.Unmarshal(stdout.Bytes(), p)
var p progress
_ = xml.Unmarshal(stdout.Bytes(), &p)
progressIndex := len(p.TaskProgress) - 1
if progressIndex >= 0 {
s.liveProgress <- p.TaskProgress[progressIndex].Percent
Expand Down

0 comments on commit 282fbd9

Please sign in to comment.