Commit c6e89947 authored by Julien Muchembled's avatar Julien Muchembled

Improve condition to determine if the output file is executable or not

parent fc8dcbb8
......@@ -108,8 +108,18 @@ class Recipe(object):
output = self.output
rendered = self._render()
mode = self.mode
mask = (0o777 if rendered.startswith(b'#!') else 0o666
) if mode is None else 0
if mode is None:
mask = 0o666
if rendered.startswith(b'#!'):
x = rendered.index(b'\n', 2)
except ValueError:
x = len(rendered)
x = rendered[2:x].split(None, 1)
if x and os.access(x[0], os.X_OK):
mask = 0o777
mask = 0
# Try to reuse existing file. This is particularly
# important to avoid excessive IO because we may render on update.
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