# Path: fluxghost/launcher.py
# def setup_env(options):
#     check_fluxclient()
#     setup_logger(options)
# 
# def show_version(verbose):
#     from fluxghost import __version__ as gfv
#     print("fluxghost %s" % gfv)
#     from fluxclient import __version__ as cfv
#     print("fluxclient %s" % cfv)


from signal import SIGTERM
from time import sleep
from fluxghost.launcher import setup_env, show_version
    from threading import Thread
    from fluxghost.http_server import HttpServer
        from tests.main import main
import argparse
import sys
import os
            import ctypes
#!/usr/bin/env python3




def trace_pid(pid):
    def _nt():
        try:
            kernel32 = ctypes.windll.kernel32
            DWORD = ctypes.c_ulong  # noqa
            DWORD_PTR = ctypes.POINTER(DWORD)  # noqa
            STILL_ALIVE = 259  # noqa

            h_process = kernel32.OpenProcess(1040, 0, pid)
            if not h_process:
                raise RuntimeError("Trace pid error, pid not exist or access deny.")

            exitcode = DWORD()

            while True:
                ret = kernel32.GetExitCodeProcess(h_process, ctypes.byref(exitcode))
                if not ret:
                    raise RuntimeError("Trace pid error, errno=%s" % kernel32.GetLastError())
                elif exitcode.value == 259:
                    sleep(0.8)

# Path: fluxghost/launcher.py
# def setup_env(options):
#     check_fluxclient()
#     setup_logger(options)
# 
# def show_version(verbose):
#     from fluxghost import __version__ as gfv
#     print("fluxghost %s" % gfv)
#     from fluxclient import __version__ as cfv
#     print("fluxclient %s" % cfv)


# Path: ghost.py
from signal import SIGTERM
from time import sleep
from fluxghost.launcher import setup_env, show_version
    from threading import Thread
    from fluxghost.http_server import HttpServer
        from tests.main import main
import argparse
import sys
import os
            import ctypes

#!/usr/bin/env python3




def trace_pid(pid):
    def _nt():
        try:
            kernel32 = ctypes.windll.kernel32
            DWORD = ctypes.c_ulong  # noqa
            DWORD_PTR = ctypes.POINTER(DWORD)  # noqa
            STILL_ALIVE = 259  # noqa

            h_process = kernel32.OpenProcess(1040, 0, pid)
            if not h_process:
                raise RuntimeError("Trace pid error, pid not exist or access deny.")

            exitcode = DWORD()

            while True:
                ret = kernel32.GetExitCodeProcess(h_process, ctypes.byref(exitcode))
                if not ret:
                    raise RuntimeError("Trace pid error, errno=%s" % kernel32.GetLastError())
                elif exitcode.value == 259:
                    sleep(0.8)

                else: