Azure / Azure/azure-cli

passing stdin to `az container exec` fails with ENOTTY

Open
#15,225 8 comments 1 reaction 0 assignees View on GitHub
act-observability-squad Container Instances Error Handling Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug
passing stdin to `az container exec` fails with ENOTTY (`termios.error: (25, 'Inappropriate ioctl for device')`)

**Command Name**
`az container exec`

**Errors:**
```
(25, 'Inappropriate ioctl for device')
Traceback (most recent call last):
python3.8/site-packages/knack/cli.py, ln 215, in invoke
cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 654, in execute
raise ex
cli/core/commands/__init__.py, ln 718, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 711, in _run_job
six.reraise(*sys.exc_info())
...
cli/command_modules/container/custom.py, ln 623, in container_exec
_start_exec_pipe(execContainerResponse.web_socket_uri, execContainerResponse.password)
cli/command_modules/container/custom.py, ln 657, in _start_exec_pipe
oldtty = termios.tcgetattr(sys.stdin)
termios.error: (25, 'Inappropriate ioctl for device')
```

## To Reproduce:

`echo "echo foo" | az container exec -g $MY_RESOURCE_GROUP --name $MY_DEBIAN_CONTAINER --exec-command "/bin/bash"`

## Expected Behavior

The stdin content should be passed to the process, and "foo" should be printed.

## Environment Summary
```
macOS-10.15.6-x86_64-i386-64bit
Python 3.8.5
Installer: HOMEBREW

azure-cli 2.11.1

```
## Additional Context
https://github.com/Azure/azure-cli/issues/13352 ("az container exec in azure devops throws (25, 'Inappropriate ioctl for device')") has the same error code but reproduction steps are different.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.