Skip to content

Commit 2165648

Browse files
committedDec 9, 2022
Fix stack trace pruning so that it has a chance of working on windows
1 parent 956e6d2 commit 2165648

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎internal/progress_report.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ func extractRunningGoroutines() ([]types.Goroutine, error) {
183183
break
184184
}
185185
}
186-
187186
r := bufio.NewReader(bytes.NewReader(stack))
188187
out := []types.Goroutine{}
189188
idx := -1
@@ -231,12 +230,12 @@ func extractRunningGoroutines() ([]types.Goroutine, error) {
231230
return nil, types.GinkgoErrors.FailedToParseStackTrace(fmt.Sprintf("Invalid function call: %s -- missing file name and line number", functionCall.Function))
232231
}
233232
line = strings.TrimLeft(line, " \t")
234-
fields := strings.SplitN(line, ":", 2)
235-
if len(fields) != 2 {
236-
return nil, types.GinkgoErrors.FailedToParseStackTrace(fmt.Sprintf("Invalid filename nad line number: %s", line))
233+
delimiterIdx := strings.LastIndex(line, ":")
234+
if delimiterIdx == -1 {
235+
return nil, types.GinkgoErrors.FailedToParseStackTrace(fmt.Sprintf("Invalid filename and line number: %s", line))
237236
}
238-
functionCall.Filename = fields[0]
239-
line = strings.Split(fields[1], " ")[0]
237+
functionCall.Filename = line[:delimiterIdx]
238+
line = strings.Split(line[delimiterIdx+1:], " ")[0]
240239
lineNumber, err := strconv.ParseInt(line, 10, 64)
241240
functionCall.Line = int(lineNumber)
242241
if err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.