Skip to content

Commit 9ab5edf

Browse files
committed
Use runpy instead of subprocess, add noconsole to pyinstaller call
1 parent 9c5e380 commit 9ab5edf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ install-deps:
1616

1717

1818
build:
19-
$(PYINSTALLER) --add-data slack-when-ready.js:. --icon=slack.ico --onefile $(ENTRY_SCRIPT)
19+
$(PYINSTALLER) --add-data slack-when-ready.js:. --noconsole --icon=slack.ico --onefile $(ENTRY_SCRIPT)
2020
# $(PYINSTALLER) --add-data slack-when-ready.js:. --onefile $(ENTRY_SCRIPT)
2121

2222
clean:

slack-when-ready

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#!/usr/bin/env python3
22

3+
import runpy
34
import subprocess
5+
import sys
46
import tkinter as tk
57
from tkinter import messagebox
68

9+
710
def show_error_dialog(title, message):
811
root = tk.Tk()
912
root.withdraw() # Hide the main window
@@ -56,7 +59,8 @@ slack_path = find_slack_executable()
5659

5760
if slack_path:
5861
print(f"Slack executable found at: {slack_path}")
59-
subprocess.run(["python3", "-m", "electron_inject", "-r", "./slack-when-ready.js", "-t", "10", "-", "slack"], stdout=None, stderr=None, check=True)
62+
sys.argv = ["electron_inject", "-r", "./slack-when-ready.js", "-t", "10", "-", "slack"]
63+
runpy.run_module("electron_inject", run_name="__main__", alter_sys=True)
6064
else:
6165
show_error_dialog("Error", "Slack executable not found.")
6266

0 commit comments

Comments
 (0)