From 78ec4f866728e76f300dbed0a6b67e7dc4a428f3 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 19 Sep 2019 01:09:03 -0400 Subject: [PATCH] this is so complicated --- bake/bakefile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bake/bakefile.py b/bake/bakefile.py index 14a4283..37b3ec2 100644 --- a/bake/bakefile.py +++ b/bake/bakefile.py @@ -310,7 +310,6 @@ class TaskScript(BaseAction): # Last script comes first. first_natural_line = sources[-1].split("\n", 1)[0] except IndexError: - # TODO: maybe not. first_natural_line = "#!/usr/bin/env bash" # Check if there's a shebang. If so, disable injection. @@ -321,7 +320,9 @@ class TaskScript(BaseAction): if insert_source and Bakefile._is_safe_to_inject(shebang=shebang): init_source = f". <(bake --source {insert_source})" yield init_source - source_container.extend(sources) + source_container.extend(sources) + else: + source_container.extend(sources[-1:]) else: shebang = "#!/usr/bin/env bash"