File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import sys
44import os
5+ import platform
56import multiprocessing
67multiprocessing .freeze_support ()
78
9+ # On Windows, hide the console window when launched via icon (not from terminal).
10+ # When double-clicked, the process is the sole owner of its console.
11+ # When run from cmd/powershell, multiple processes share the console - don't hide it.
12+ if platform .system () == "Windows" and getattr (sys , 'frozen' , False ):
13+ import ctypes
14+ kernel32 = ctypes .windll .kernel32
15+ hwnd = kernel32 .GetConsoleWindow ()
16+ if hwnd :
17+ pid = ctypes .c_ulong ()
18+ ctypes .windll .user32 .GetWindowThreadProcessId (hwnd , ctypes .byref (pid ))
19+ if pid .value == os .getpid ():
20+ ctypes .windll .user32 .ShowWindow (hwnd , 0 ) # SW_HIDE
21+
822from pathlib import Path
923from frontend .customhttpserver import CustomHTTPServer
1024from frontend .api import API
You can’t perform that action at this time.
0 commit comments