Exemplo n.º 1
0
def jython_reloader(main_func, args, kwargs):
    from _systemrestart import SystemRestart
    thread.start_new_thread(main_func, args)
    while True:
        if code_changed():
            raise SystemRestart
        time.sleep(1)
Exemplo n.º 2
0
def jython_reloader(main_func, args, kwargs):
    from _systemrestart import SystemRestart
    thread.start_new_thread(main_func, args)
    while True:
        if code_changed():
            raise SystemRestart
        time.sleep(1)
Exemplo n.º 3
0
def python_reloader(main_func, args, kwargs):
    if os.environ.get("RUN_MAIN") == "true":
        thread.start_new_thread(main_func, args, kwargs)
        try:
            reloader_thread()
        except KeyboardInterrupt:
            pass
    else:
        try:
            exit_code = restart_with_reloader()
            if exit_code < 0:
                os.kill(os.getpid(), -exit_code)
            else:
                sys.exit(exit_code)
        except KeyboardInterrupt:
            pass
Exemplo n.º 4
0
def python_reloader(main_func, args, kwargs):
    if os.environ.get("RUN_MAIN") == "true":
        thread.start_new_thread(main_func, args, kwargs)
        try:
            reloader_thread()
        except KeyboardInterrupt:
            pass
    else:
        try:
            exit_code = restart_with_reloader()
            if exit_code < 0:
                os.kill(os.getpid(), -exit_code)
            else:
                sys.exit(exit_code)
        except KeyboardInterrupt:
            pass
Exemplo n.º 5
0
    def handle(self, *args, **options):
        # Automatically exit if our own code changes.
        # This is not based on a published API, so quite likely will fail
        # and need to be updated in a future version of django

        # Start our work in a background thread
        thread.start_new_thread(self.inner_handle, ())

        try:
            while True:
                if autoreload.USE_INOTIFY:
                    change = autoreload.inotify_code_changed()
                else:
                    change = autoreload.code_changed()
                if change == autoreload.FILE_MODIFIED:
                    self.stderr.write(
                        "Underlying code changed, exiting for a restart")
                    sys.exit(0)
                # Poll for changes every 10 seconds if the inotify method doesn't work
                time.sleep(10)
        except KeyboardInterrupt:
            pass
Exemplo n.º 6
0
# Autoreloading launcher.
Exemplo n.º 7
0
def precompile_and_watch_coffee_and_sass_assets():
    thread.start_new_thread(
        precompile_coffee_and_sass_assets, (), {
            'watch': True,
            'kill_on_error': True
        })
Exemplo n.º 8
0
def precompile_and_watch_coffee_and_sass_assets():
    thread.start_new_thread(precompile_coffee_and_sass_assets, (), {
        'watch': True,
        'kill_on_error': True
    })
Exemplo n.º 9
0
                str_key = key.decode(encoding).encode('utf-8')
                str_value = new_environ[key].decode(encoding).encode('utf-8')
                del new_environ[key]
                new_environ[str_key] = str_value
=======
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        new_environ["RUN_MAIN"] = 'true'
        exit_code = subprocess.call(args, env=new_environ)
        if exit_code != 3:
            return exit_code


def python_reloader(main_func, args, kwargs):
    if os.environ.get("RUN_MAIN") == "true":
<<<<<<< HEAD
        thread.start_new_thread(main_func, args, kwargs)
=======
        _thread.start_new_thread(main_func, args, kwargs)
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        try:
            reloader_thread()
        except KeyboardInterrupt:
            pass
    else:
        try:
            exit_code = restart_with_reloader()
            if exit_code < 0:
                os.kill(os.getpid(), -exit_code)
            else:
                sys.exit(exit_code)
        except KeyboardInterrupt: