diff --git a/further_link/runner/exec_process_handler.py b/further_link/runner/exec_process_handler.py index 9ef2b0ee..7dae0066 100644 --- a/further_link/runner/exec_process_handler.py +++ b/further_link/runner/exec_process_handler.py @@ -20,12 +20,14 @@ async def _start(self, path, code=None, novncOptions={}): path = get_absolute_path(path, get_working_directory(self.user)) # create path directories if they don't already exist + logging.debug(f"{self.id} Creating working directory for exec") await create_directory(os.path.dirname(path), self.user) entrypoint = path if code is None else os.path.join(path, f"exec-{self.id}") # create a temporary file to execute if code is provided if code is not None: + logging.debug(f"{self.id} Creating entrypoint for exec") await write_file(entrypoint, code) self._remove_entrypoint = entrypoint diff --git a/further_link/runner/process_handler.py b/further_link/runner/process_handler.py index dee8b803..24227af7 100644 --- a/further_link/runner/process_handler.py +++ b/further_link/runner/process_handler.py @@ -299,9 +299,13 @@ async def _clean_up(self): logging.debug(f"{self.id} Cleaning up PTY") try: if getattr(self, "pty_master", None): + logging.debug(f"{self.id} Closing PTY master") await self.pty_master.close() + logging.debug(f"{self.id} Closed PTY master") if getattr(self, "pty_slave", None): + logging.debug(f"{self.id} Closing PTY slave") await self.pty_slave.close() + logging.debug(f"{self.id} Closed PTY slave") except Exception as e: logging.exception(f"{self.id} PTY Cleanup error: {e}") diff --git a/further_link/runner/py_process_handler.py b/further_link/runner/py_process_handler.py index 3e2b2db4..19cd1c22 100644 --- a/further_link/runner/py_process_handler.py +++ b/further_link/runner/py_process_handler.py @@ -19,12 +19,14 @@ async def _start(self, path, code=None, novncOptions={}): path = get_absolute_path(path, get_working_directory(self.user)) # create path directories if they don't already exist + logging.debug(f"{self.id} Creating working directory for python3") await create_directory(os.path.dirname(path), self.user) entrypoint = path if code is None else os.path.join(path, f"{self.id}.py") # create a temporary file to execute if code is provided if code is not None: + logging.debug(f"{self.id} Creating entrypoint for python3") await write_file(entrypoint, code) self._remove_entrypoint = entrypoint diff --git a/further_link/runner/shell_process_handler.py b/further_link/runner/shell_process_handler.py index 598b2c07..497c525f 100644 --- a/further_link/runner/shell_process_handler.py +++ b/further_link/runner/shell_process_handler.py @@ -1,3 +1,5 @@ +import logging + from ..util.upload import create_directory from ..util.user_config import get_absolute_path, get_shell, get_working_directory from .process_handler import ProcessHandler @@ -8,6 +10,7 @@ async def _start(self, path, code=None, novncOptions={}): work_dir = get_absolute_path(path, get_working_directory(self.user)) # create work dir if it doesn't already exist + logging.debug(f"{self.id} Creating working directory for shell") await create_directory(work_dir, self.user) await super()._start(get_shell(self.user), work_dir, novncOptions=novncOptions) diff --git a/further_link/util/async_files.py b/further_link/util/async_files.py index 87567654..c9388a2a 100644 --- a/further_link/util/async_files.py +++ b/further_link/util/async_files.py @@ -32,11 +32,8 @@ async def symlink(src, dst): async def write_file(path, content, mode="w+"): def sync_write_file(p, c): - print("opening file") with open(p, mode) as file: - print("file open") file.write(c) - print("file written") await asyncio.to_thread(partial(sync_write_file, path, content))