[GH-ISSUE #51] pty test fails with "Inappropriate ioctl for device" #41

Closed
opened 2026-02-25 20:32:23 +03:00 by kerem · 1 comment
Owner

Originally created by @jakubjedelsky on GitHub (Jan 27, 2014).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/51

Pty test fails when runs with routed output (eg. piped to tee command). Problem is in fcntl.ioctl, which return error in non-interactive shell environment.

nosetests -v tests/pty_recorder_test.py | tee tests.log

======================================================================
ERROR: tests.pty_recorder_test.TestPtyRecorder.test_record_command_returns_stdout_instance
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/asciinema-0.9.7/tests/pty_recorder_test.py", line 37, in test_record_command_returns_stdout_instance
    output = pty_recorder.record_command('ls -l')
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 102, in record_command
    _set_pty_size()
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 30, in _set_pty_size
    fcntl.ioctl(pty.STDOUT_FILENO, termios.TIOCGWINSZ, buf, True)
IOError: [Errno 25] Inappropriate ioctl for device
======================================================================
ERROR: tests.pty_recorder_test.TestPtyRecorder.test_record_command_writes_to_stdout
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/asciinema-0.9.7/tests/pty_recorder_test.py", line 47, in test_record_command_writes_to_stdout
    pty_recorder.record_command(command, output)
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 102, in record_command
    _set_pty_size()
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 30, in _set_pty_size
    fcntl.ioctl(pty.STDOUT_FILENO, termios.TIOCGWINSZ, buf, True)
IOError: [Errno 25] Inappropriate ioctl for device
----------------------------------------------------------------------
Originally created by @jakubjedelsky on GitHub (Jan 27, 2014). Original GitHub issue: https://github.com/asciinema/asciinema/issues/51 Pty test fails when runs with routed output (eg. piped to `tee` command). Problem is in `fcntl.ioctl`, which return error in non-interactive shell environment. `nosetests -v tests/pty_recorder_test.py | tee tests.log` ``` ====================================================================== ERROR: tests.pty_recorder_test.TestPtyRecorder.test_record_command_returns_stdout_instance ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/builddir/build/BUILD/asciinema-0.9.7/tests/pty_recorder_test.py", line 37, in test_record_command_returns_stdout_instance output = pty_recorder.record_command('ls -l') File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 102, in record_command _set_pty_size() File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 30, in _set_pty_size fcntl.ioctl(pty.STDOUT_FILENO, termios.TIOCGWINSZ, buf, True) IOError: [Errno 25] Inappropriate ioctl for device ====================================================================== ERROR: tests.pty_recorder_test.TestPtyRecorder.test_record_command_writes_to_stdout ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/builddir/build/BUILD/asciinema-0.9.7/tests/pty_recorder_test.py", line 47, in test_record_command_writes_to_stdout pty_recorder.record_command(command, output) File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 102, in record_command _set_pty_size() File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 30, in _set_pty_size fcntl.ioctl(pty.STDOUT_FILENO, termios.TIOCGWINSZ, buf, True) IOError: [Errno 25] Inappropriate ioctl for device ---------------------------------------------------------------------- ```
kerem closed this issue 2026-02-25 20:32:23 +03:00
Author
Owner

@ku1ik commented on GitHub (Mar 18, 2014):

Closing as #52 fixed that.

<!-- gh-comment-id:37991719 --> @ku1ik commented on GitHub (Mar 18, 2014): Closing as #52 fixed that.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#41
No description provided.