aboutsummaryrefslogtreecommitdiff
path: root/src/sandbox.py
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-11 14:27:26 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-11 14:27:26 +0200
commitd0a80859f630866461e8a888b3f8fe008c8158ba (patch)
treead0ebcc42a620aeea5a4407e1cacbac24faf1dcb /src/sandbox.py
parent46ba2708f83bf46186c33bf84975d39e87f467c1 (diff)
downloadminishell_test-d0a80859f630866461e8a888b3f8fe008c8158ba.tar.gz
minishell_test-d0a80859f630866461e8a888b3f8fe008c8158ba.tar.bz2
minishell_test-d0a80859f630866461e8a888b3f8fe008c8158ba.zip
Added suite group and suite bonus, Added signal (not tested)
Diffstat (limited to 'src/sandbox.py')
-rw-r--r--src/sandbox.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/sandbox.py b/src/sandbox.py
new file mode 100644
index 0000000..e900076
--- /dev/null
+++ b/src/sandbox.py
@@ -0,0 +1,32 @@
+# ############################################################################ #
+# #
+# ::: :::::::: #
+# sandbox.py :+: :+: :+: #
+# +:+ +:+ +:+ #
+# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
+# +#+#+#+#+#+ +#+ #
+# Created: 2020/09/11 13:48:07 by charles #+# #+# #
+# Updated: 2020/09/11 13:50:08 by charles ### ########.fr #
+# #
+# ############################################################################ #
+
+import os
+import glob
+import shutil
+import subprocess
+
+import config
+
+def create():
+ try:
+ os.mkdir(config.SANDBOX_PATH)
+ except OSError:
+ pass
+
+
+def remove():
+ try:
+ shutil.rmtree(config.SANDBOX_PATH)
+ except:
+ subprocess.run(["chmod", "777", *glob.glob(config.SANDBOX_PATH + "/*")], check=True)
+ subprocess.run(["rm", "-rf", config.SANDBOX_PATH], check=True)