I use minitest-mode which starts Ruby tests in compilation-mode:

 (lambda (arg) (minitest-buffer-name (or file-name ""))))

Tests invoke psql program, and it thinks like it's running in interactive terminal, so it outputs some of its output through pager (less). Because compilation-mode buffer is not a real interactive terminal, I can't press keys to close less and continue, so test process freezes and requires killing.

Is it possible to make compilation-mode run program in non-interactive terminal (as I understand, it should not allocate pty)? When looking at ps output, it looks like it has its own tty:

18046 ttys004    0:02.51 ruby -Ilib:test:spec test/functional/ads_controller_test.rb
18063 ttys004    0:02.41 ruby bin/rails db:test:prepare
  • Also, the part of the problem is that compilation buffer's tty does not implement TIOCGWINSZ ioctl, so psql decides to run pager regardless of output size. – kolen Dec 4 '18 at 20:01
  • 1
    Have you tried putting your compilation buffer in comint mode? Activate it with C-u M-x compile. This allows you to enter text at the prompt. Also, what is the value of environment variable TERM? – InHarmsWay Dec 6 '18 at 3:40
  • 1
    Perhaps the easiest thing you can do to disable pager is to change actual-command to be sh -c "actual-command". Unless sh is called with -i flag, it will not allocate tty and whatever other programs it will run will not try to second-guess you about pagers etc. Also, something I find myself doing quite often in this situation is running actual-command | cat, which also disables pagers. – wvxvw Dec 6 '18 at 13:17
  • @InHarmsWay thanks, activating comint-mode allows to interact with terminal, I didn't know about this possibility. TERM is set to dumb. – kolen Dec 6 '18 at 21:06
  • @wvxvw for my case, sh -c didn't disable paging, but | cat disabled it successfully. In both cases, underlying command (ruby) had tty. – kolen Dec 6 '18 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.