MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / parseBashTimeoutValue

Function parseBashTimeoutValue

tools/builtin.go:1623–1652  ·  view source on GitHub ↗
(value any, legacyTimeoutField bool)

Source from the content-addressed store, hash-verified

1621
1622func editLineCount(content string) int {
1623 if content == "" {
1624 return 0
1625 }
1626 count := strings.Count(content, "\n")
1627 if !strings.HasSuffix(content, "\n") {
1628 count++
1629 }
1630 return count
1631}
1632
1633func (t *BashTool) executeBackground(execCtx ExecutionContext, command, description string, argv []string, cwd string, timeout time.Duration) (string, error) {
1634 if t.backgroundManager == nil {
1635 if cwd == "" {
1636 cwd = "."
1637 }
1638 resultsDir := toolResultsDirFromContext(execCtx, cwd)
1639 manager, err := bashpkg.NewBackgroundManagerForResults(resultsDir)
1640 if err != nil {
1641 return "Could not start background task: " + err.Error(), nil
1642 }
1643 t.backgroundManager = manager
1644 }
1645 bgTimeout := timeout
1646 var timeoutPtr *time.Duration
1647 if bgTimeout >= 120*time.Second {
1648 timeoutPtr = nil
1649 } else {
1650 timeoutPtr = &bgTimeout
1651 }
1652 task, err := t.backgroundManager.StartBackgroundWithOptionalTimeoutArgv(command, description, argv, cwd, timeoutPtr)
1653 if err != nil {
1654 return fmt.Sprintf("Could not start background task: %s\nCurrent active tasks: %d", err, t.backgroundManager.ActiveCount()), nil
1655 }

Callers 1

parseBashTimeoutSecondsFunction · 0.85

Calls 3

numericBashTimeoutFunction · 0.85
validatePositiveTimeoutFunction · 0.85
parseBashTimeoutStringFunction · 0.85

Tested by

no test coverage detected