File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 44'''
55import os
66import platform
7+ import psutil
78import requests
89from rich import box , print
9- from rich .console import Console , Group , group
10+ from rich .console import Console , group
1011from rich .panel import Panel
1112from rich .prompt import Prompt
1213from rich .style import Style
13- from rich .syntax import Syntax
14- from rich .text import Text
1514
1615from ldm .invoke import __version__
1716
3231def get_versions ()-> dict :
3332 return requests .get (url = INVOKE_AI_REL ).json ()
3433
34+ def invokeai_is_running ()-> bool :
35+ for p in psutil .process_iter ():
36+ try :
37+ cmdline = p .cmdline ()
38+ matches = [x for x in cmdline if x .endswith (('invokeai' ,'invokeai.exe' ))]
39+ if matches :
40+ print (f':exclamation: [bold red]An InvokeAI instance appears to be running as process { p .pid } [/red bold]' )
41+ return True
42+ except psutil .AccessDenied :
43+ continue
44+ return False
45+
46+
3547def welcome (versions : dict ):
3648
3749 @group ()
@@ -62,6 +74,10 @@ def text():
6274
6375def main ():
6476 versions = get_versions ()
77+ if invokeai_is_running ():
78+ print (f':exclamation: [bold red]Please terminate all running instances of InvokeAI before updating.[/red bold]' )
79+ return
80+
6581 welcome (versions )
6682
6783 tag = None
You can’t perform that action at this time.
0 commit comments