check bun pm ls before bouncing server
This commit is contained in:
parent
be30878c84
commit
60286590c7
@ -85,6 +85,17 @@ def run_process_and_launch_url(run_command: list[str], backend_present=True):
|
|||||||
console.print(
|
console.print(
|
||||||
f"DETECT_PACKAGE_CHANGE init {last_hash}, {json.dumps(json.loads(json_file_path.read_text()))}"
|
f"DETECT_PACKAGE_CHANGE init {last_hash}, {json.dumps(json.loads(json_file_path.read_text()))}"
|
||||||
)
|
)
|
||||||
|
last_packages = (
|
||||||
|
processes.new_process(
|
||||||
|
["bun", "pm", "ls"],
|
||||||
|
cwd=get_web_dir(),
|
||||||
|
)
|
||||||
|
.stdout.read()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
console.print(
|
||||||
|
f"DETECT_PACKAGE_CHANGE init {last_packages}",
|
||||||
|
)
|
||||||
process = None
|
process = None
|
||||||
first_run = True
|
first_run = True
|
||||||
|
|
||||||
@ -129,15 +140,28 @@ def run_process_and_launch_url(run_command: list[str], backend_present=True):
|
|||||||
)
|
)
|
||||||
new_hash = detect_package_change(json_file_path)
|
new_hash = detect_package_change(json_file_path)
|
||||||
if new_hash != last_hash:
|
if new_hash != last_hash:
|
||||||
console.print("Reloading app due to new content...")
|
|
||||||
new_content = json.dumps(json.loads(json_file_path.read_text()))
|
new_content = json.dumps(json.loads(json_file_path.read_text()))
|
||||||
console.print(
|
console.print(
|
||||||
f"DETECT_PACKAGE_CHANGE hit {last_hash} != {new_hash} (new), {new_content}"
|
f"DETECT_PACKAGE_CHANGE hit {last_hash} != {new_hash} (new), {new_content}"
|
||||||
)
|
)
|
||||||
last_hash = new_hash
|
last_hash = new_hash
|
||||||
kill(process.pid)
|
new_packages = (
|
||||||
process = None
|
processes.new_process(
|
||||||
break # for line in process.stdout
|
["bun", "pm", "ls"],
|
||||||
|
cwd=get_web_dir(),
|
||||||
|
)
|
||||||
|
.stdout.read()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
console.print(
|
||||||
|
f"DETECT_PACKAGE_CHANGE init {new_packages}",
|
||||||
|
)
|
||||||
|
if new_packages != last_packages:
|
||||||
|
last_packages = new_packages
|
||||||
|
console.print("Reloading app due to new content...")
|
||||||
|
kill(process.pid)
|
||||||
|
process = None
|
||||||
|
break # for line in process.stdout
|
||||||
if process is not None:
|
if process is not None:
|
||||||
break # while True
|
break # while True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user