Browse code

tkuratomi bugfix for BOMs in powershell modules

fixes #15998

(cherry picked from commit 31e963dd2a499a9c6eca8c5f30b480a9b867f84b)

nitzmahone authored on 2016/07/12 03:51:28
Showing 1 changed files
... ...
@@ -668,6 +668,12 @@ def _find_snippet_imports(module_name, module_data, module_path, module_args, ta
668 668
         module_args_json = to_bytes(json.dumps(module_args))
669 669
         module_data = module_data.replace(REPLACER_JSONARGS, module_args_json)
670 670
 
671
+        # Powershell/winrm don't actually make use of shebang so we can
672
+        # safely set this here.  If we let the fallback code handle this
673
+        # it can fail in the presence of the UTF8 BOM commonly added by
674
+        # Windows text editors
675
+        shebang = u'#!powershell'
676
+
671 677
         # Sanity check from 1.x days.  This is currently useless as we only
672 678
         # get here if we are going to substitute powershell.ps1 into the
673 679
         # module anyway.  Leaving it for when/if we add other powershell