Commit 4cc050ae authored by Nicolas Dumazet's avatar Nicolas Dumazet

Do not crash if the working directory exists

When installation fails, the working directory is left in place: further
calls to cmmi recipe with the same arguments should not raise an
OSError.
Let the download recipe handle the error, and print a friendly error.
parent a86e6988
import hexagonit.recipe.download
import errno
import imp
import logging
import os
......@@ -98,7 +99,13 @@ class Recipe(object):
# Download the source using hexagonit.recipe.download
if self.options['url']:
compile_dir = self.options['compile-directory']
os.mkdir(compile_dir)
try:
os.mkdir(compile_dir)
except OSError, e:
# leftovers from a previous failed attempt,
# download recipe will raise a clean error message
if e.errno != errno.EEXIST:
raise
try:
opt = self.options.copy()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment