mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-24 11:17:26 -04:00
check if sandbox is running on bootup
This commit is contained in:
parent
d1aa1e6536
commit
e31fa51046
4 changed files with 32 additions and 9 deletions
|
@ -128,5 +128,33 @@ func kill_sandbox_macos() -> void:
|
|||
Debug.logclr("Process killed " + str(snbx_pid), Color.DIM_GRAY)
|
||||
|
||||
|
||||
func is_sandbox_running() -> bool:
|
||||
if snbx_pid == 0: return false
|
||||
|
||||
match Platform.get_platform():
|
||||
Platform.WINDOWS:
|
||||
var output = []
|
||||
OS.execute("cmd.exe", ["/c", "tasklist", "|", "findstr", snbx_pid], output)
|
||||
Debug.logclr("tasklist: " + str(output), Color.DIM_GRAY)
|
||||
return not output[0].is_empty()
|
||||
|
||||
Platform.LINUX_BSD:
|
||||
var output = []
|
||||
OS.execute("ps", ["-o", "pid=", "-p", snbx_pid], output)
|
||||
Debug.logclr("ps: " + str(output), Color.DIM_GRAY)
|
||||
return not output[0].is_empty()
|
||||
|
||||
Platform.MACOS:
|
||||
var output = []
|
||||
OS.execute("ps", ["-o", "pid=", "-p", snbx_pid], output)
|
||||
Debug.logclr("ps: " + str(output), Color.DIM_GRAY)
|
||||
return not output[0].is_empty()
|
||||
|
||||
_:
|
||||
assert(false, "Platform is not supported")
|
||||
|
||||
return false
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
kill_sandbox()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue