diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-03-03 09:19:20 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-03-03 09:19:20 +0100 |
| commit | 716265929bf861d340c1e71e2f24359875520d3a (patch) | |
| tree | d6e536e42de09d7a908c559aa5b51d36936a4e5b /minishell_test/sandbox.py | |
| parent | a90ac1b352bd5f7c2c677f051365401531229976 (diff) | |
| download | minishell_test-716265929bf861d340c1e71e2f24359875520d3a.tar.gz minishell_test-716265929bf861d340c1e71e2f24359875520d3a.tar.bz2 minishell_test-716265929bf861d340c1e71e2f24359875520d3a.zip | |
Added sandbox and colors tests
Diffstat (limited to 'minishell_test/sandbox.py')
| -rw-r--r-- | minishell_test/sandbox.py | 10 |
1 files changed, 4 insertions, 6 deletions
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 |
