summaryrefslogtreecommitdiffstats
path: root/src/virtBootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'src/virtBootstrap')
-rw-r--r--src/virtBootstrap/utils.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py
index 923309a..9d477db 100644
--- a/src/virtBootstrap/utils.py
+++ b/src/virtBootstrap/utils.py
@@ -179,12 +179,13 @@ def get_mime_type(path):
"""
Get the mime type of a file.
"""
- return (
- subprocess.Popen(
- ["/usr/bin/file", "--mime-type", path],
- stdout=subprocess.PIPE
- ).stdout.read().decode('utf-8').split()[1]
+ proc = subprocess.Popen(
+ ["/usr/bin/file", "--mime-type", path],
+ stdout=subprocess.PIPE
)
+ proc.wait()
+ with proc.stdout as output:
+ return output.read().decode('utf-8').split()[1]
def create_qcow2(tar_file, layer_file, backing_file=None, size=DEF_QCOW2_SIZE):