How to tell docker-compose exec to read from stdin?

Viewed 2955

docker-compose exec is failing when reading from stdin:

$ echo "use mydb; show measurements;" | docker-compose exec influxdb influx
Connected to http://localhost:8086 version 1.2.4
InfluxDB shell version: 1.2.4
> Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.9.0', 'console_scripts', 'docker-compose')()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 65, in main
    command()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 117, in perform_command
    handler(command, command_options)
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 462, in exec_command
    pty.start()
  File "/usr/local/lib/python2.7/dist-packages/dockerpty/pty.py", line 338, in start
    io.set_blocking(pump, flag)
  File "/usr/local/lib/python2.7/dist-packages/dockerpty/io.py", line 32, in set_blocking
    old_flag = fcntl.fcntl(fd, fcntl.F_GETFL)
ValueError: file descriptor cannot be a negative integer (-1)

Using the -T flag gets rid of the problem, but it seems to suppress reading from stdin:

$ echo "use mydb; show measurements;" | docker-compose exec -T influxdb influx

(I need to kill that command, since it shows nothing and is not able to read from stdin)

This seems like a docker-compose bug, maybe I should file this?

$ docker-compose --version
docker-compose version 1.9.0, build 2585387

EDIT

Related:

1 Answers
Related