diff options
Diffstat (limited to 'minishell_test')
| -rw-r--r-- | minishell_test/colors.py | 8 | ||||
| -rw-r--r-- | minishell_test/sandbox.py | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/minishell_test/colors.py b/minishell_test/colors.py index 7b6cf45..f0c97fb 100644 --- a/minishell_test/colors.py +++ b/minishell_test/colors.py @@ -23,6 +23,14 @@ def disable() -> None: _COLORS["close"] = "" +def enable() -> None: + _COLORS["red"] = _DEFAULTS["red"] + _COLORS["green"] = _DEFAULTS["green"] + _COLORS["blue"] = _DEFAULTS["blue"] + _COLORS["bold"] = _DEFAULTS["bold"] + _COLORS["close"] = _DEFAULTS["close"] + + def green(s: str) -> str: return _COLORS["green"] + s + _COLORS["close"] diff --git a/minishell_test/sandbox.py b/minishell_test/sandbox.py index d579847..6fafc36 100644 --- a/minishell_test/sandbox.py +++ b/minishell_test/sandbox.py @@ -6,23 +6,21 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 13:48:07 by charles #+# #+# # -# Updated: 2021/02/27 12:32:17 by cacharle ### ########.fr # +# Updated: 2021/03/03 09:15:11 by cacharle ### ########.fr # # # # ############################################################################ # import shutil import subprocess from contextlib import contextmanager +from pathlib import Path from minishell_test.config import Config def create(): """Create a new sandbox directory""" - try: - Config.sandbox_dir.mkdir(parents=True, exist_ok=True) - except OSError: - pass + Config.sandbox_dir.mkdir(parents=True, exist_ok=True) def remove(): @@ -32,7 +30,7 @@ def remove(): try: shutil.rmtree(Config.sandbox_dir) except PermissionError: - subprocess.run(["chmod", "777", *Config.sandbox_dir.glob("*")], check=True) + subprocess.run(["chmod", "-R", "777", Config.sandbox_dir], check=True) shutil.rmtree(Config.sandbox_dir) except FileNotFoundError: pass |
