| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dd8739a commit eacb85a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,9 @@ | |||
| 29 | 29 | except ImportError: | |
| 30 | 30 | pass | |
| 31 | 31 | ||
| 32 | + # Only reachable once curses imported, so the platform has fcntl too. | ||
| 33 | + import fcntl | ||
| 34 | + | ||
| 32 | 35 | def requires_curses_func(name): | |
| 33 | 36 | return unittest.skipUnless(hasattr(curses, name), | |
| 34 | 37 | 'requires curses.%s' % name) | |
@@ -164,6 +167,10 @@ def setUp(self): | |||
| 164 | 167 | # ScreenTests run newterm()/set_term() in the same process. | |
| 165 | 168 | try: | |
| 166 | 169 | infd = sys.__stdin__.fileno() | |
| 170 | + if fcntl.fcntl(infd, fcntl.F_GETFL) & os.O_ACCMODE == os.O_WRONLY: | ||
| 171 | + # newterm() needs a readable input fd; a write-only stdin | ||
| 172 | + # (as nohup leaves for a backgrounded run) fails with EINVAL. | ||
| 173 | + infd = stdout_fd | ||
| 167 | 174 | except (AttributeError, ValueError, OSError): | |
| 168 | 175 | infd = stdout_fd | |
| 169 | 176 | self.screen = curses.newterm(term, stdout_fd, infd) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments