MCPcopy Create free account
hub / github.com/Louisym/MiniCC / should_auto_background

Function should_auto_background

tutorials/14_bash_engine_deep_dive.py:660–666  ·  view source on GitHub ↗

决定是否自动后台化

(command: str, elapsed: float)

Source from the content-addressed store, hash-verified

658 SLEEP_COMMANDS = {"sleep"} # 禁止自动后台化的命令
659
660 def should_auto_background(command: str, elapsed: float) -> bool:
661 """决定是否自动后台化"""
662 # 检查是否是 sleep 命令
663 first_word = command.strip().split()[0] if command.strip() else ""
664 if first_word in SLEEP_COMMANDS:
665 return False # sleep 不允许自动后台化
666 return elapsed > AUTO_BG_THRESHOLD_SECONDS
667
668 test_cases = [
669 ("npm install", 20.0, True),

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected