aws-cloudformation/cloudformation-cli-typescript-plugin

Trying to run /bin/bash on Windows version during `cfn submit`

mmaeng opened this issue · 0 comments

On Windows cfn submit --dry-run and its variations are trying to run /bin/bash and failing since that location doesn't exist

[2022-10-21T01:40:08Z] DEBUG    - command is 'npm install --optional && sam build --debug --build-dir C:\Users\mmaeng\Documents\source\s3-resource/build --use-container TypeFunction'
[2022-10-21T01:40:08Z] WARNING  - Starting build.
[2022-10-21T01:40:08Z] DEBUG    - Caught downstream error
Traceback (most recent call last):
  File "C:\Users\mmaeng\Documents\source\.venv\lib\site-packages\rpdk\typescript\codegen.py", line 254, in _build
    completed_proc = subprocess_run(  # nosec
  File "C:\Program Files\Python310\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\users\mmaeng\documents\source\cloudformation-cli\src\rpdk\core\cli.py", line 100, in main
    args.command(args)
  File "c:\users\mmaeng\documents\source\cloudformation-cli\src\rpdk\core\submit.py", line 15, in submit
    project.submit(
  File "c:\users\mmaeng\documents\source\cloudformation-cli\src\rpdk\core\project.py", line 630, in submit
    self._add_resources_content_to_zip(zip_file)
  File "c:\users\mmaeng\documents\source\cloudformation-cli\src\rpdk\core\project.py", line 658, in _add_resources_content_to_zip
    self._plugin.package(self, zip_file)
  File "C:\Users\mmaeng\Documents\source\.venv\lib\site-packages\rpdk\typescript\codegen.py", line 215, in package
    self._build(project.root)
  File "C:\Users\mmaeng\Documents\source\.venv\lib\site-packages\rpdk\typescript\codegen.py", line 262, in _build
    raise DownstreamError("local build failed") from e
rpdk.core.exceptions.DownstreamError: local build failed

Relevant section in code.

LOG.warning("Starting build.")
try:
completed_proc = subprocess_run( # nosec
["/bin/bash", "-c", command],
stdout=PIPE,
stderr=PIPE,
cwd=base_path,
check=True,
)
except (FileNotFoundError, CalledProcessError) as e:
raise DownstreamError("local build failed") from e