Related command
$cmd = "/app/data/clean.sh"
& az containerapp exec `
--name $container_name `
--resource-group $rg_name `
--command $cmd `
--debug
Describe the bug
When running az containerapp exec non-interactively, terminal control operation fails. The azure cli tries to resize the terminal (evidenced by os.get_terminal_size() call followed by OSError: [Errno 25] Inappropriate ioctl for device error). The underlying error happens in termios.tcgetattr(fd) function. See Additional Context below for details.
To Reproduce
- Deploy Container Apps Environment
- Create a shell script (hello.sh)
- Deploy Container with the shell script
FROM mcr.microsoft.com/dotnet/runtime:6.0-jammy
COPY ./hello.sh /hello.sh
RUN chmod +x /hello.sh
ENTRYPOINT ["tail", "-f", "/dev/null"]
- Run the shell script with
az containerapp exec locally to verify it works (it should work both on windows and ubuntu)
- Run the shell script with
az containerapp exec in github actions (it fails, both with ubuntu-latest and windows-latest)
Expected behavior
Should echo 'hello'
Environment summary
Github Actions
Current runner version:
Operating System
Ubuntu
22.04
LTS
Runner Image
Image: ubuntu-22.04
Version: 20230409
Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230409.1/images/linux/Ubuntu2204-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230409.1
Runner Image Provisioner
5.0.139.1
Additional context
Exception in thread Thread-1 (read_ssh):
Traceback (most recent call last):
File "/opt/az/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/opt/az/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/opt/az/azcliextensions/containerapp/azext_containerapp/_ssh_utils.py", line 123, in read_ssh
_resize_terminal(connection)
File "/opt/az/azcliextensions/containerapp/azext_containerapp/_ssh_utils.py", line 154, in _resize_terminal
size = os.get_terminal_size()
OSError: [Errno 25] Inappropriate ioctl for device
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/azcliextensions/containerapp/azext_containerapp/custom.py", line 2716, in containerapp_ssh
writer = get_stdin_writer(conn)
File "/opt/az/azcliextensions/containerapp/azext_containerapp/_ssh_utils.py", line 187, in get_stdin_writer
tty.setcbreak(sys.stdin.fileno()) # needed to prevent printing arrow key characters
File "/opt/az/lib/python3.10/tty.py", line 32, in setcbreak
mode = tcgetattr(fd)
termios.error: (25, 'Inappropriate ioctl for device')
Related command
Describe the bug
When running az containerapp exec non-interactively, terminal control operation fails. The azure cli tries to resize the terminal (evidenced by
os.get_terminal_size()call followed byOSError: [Errno 25] Inappropriate ioctl for deviceerror). The underlying error happens intermios.tcgetattr(fd)function. See Additional Context below for details.To Reproduce
az containerapp execlocally to verify it works (it should work both on windows and ubuntu)az containerapp execin github actions (it fails, both with ubuntu-latest and windows-latest)Expected behavior
Should echo 'hello'
Environment summary
Additional context