summaryrefslogtreecommitdiff
path: root/support/lib/util.py
diff options
context:
space:
mode:
authorMichael Schwarz <michi.schwarz@gmail.com>2014-12-10 22:18:14 +0100
committerMichael Schwarz <michi.schwarz@gmail.com>2014-12-10 22:18:14 +0100
commit60b25ad13d0fdee926006bc728b031c4da1fb931 (patch)
treef3c7a1ca6be13e16ab60c991bd536dd025ed0e7d /support/lib/util.py
parent8e5a1520cd5e901f514c382ad17e77d64727896a (diff)
downloadpogojig-60b25ad13d0fdee926006bc728b031c4da1fb931.tar.gz
pogojig-60b25ad13d0fdee926006bc728b031c4da1fb931.tar.bz2
pogojig-60b25ad13d0fdee926006bc728b031c4da1fb931.zip
Extracted common functions to separate module.
Diffstat (limited to 'support/lib/util.py')
-rw-r--r--support/lib/util.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/support/lib/util.py b/support/lib/util.py
new file mode 100644
index 0000000..a3bc3dc
--- /dev/null
+++ b/support/lib/util.py
@@ -0,0 +1,18 @@
+import contextlib, subprocess, tempfile, shutil
+
+
+@contextlib.contextmanager
+def TemporaryDirectory():
+ dir = tempfile.mkdtemp()
+
+ try:
+ yield dir
+ finally:
+ shutil.rmtree(dir)
+
+
+def command(args):
+ process = subprocess.Popen(args)
+ process.wait()
+
+ assert not process.returncode