决定是否自动后台化
(command: str, elapsed: float)
| 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), |
no outgoing calls
no test coverage detected