Opened 6 years ago
Closed 6 years ago
#21743 closed defect (fixed)
Crash when stdin is not a tty
Reported by: | vbraun | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-7.5 |
Component: | interfaces | Keywords: | |
Cc: | Merged in: | ||
Authors: | Volker Braun | Reviewers: | Jeroen Demeyer |
Report Upstream: | N/A | Work issues: | |
Branch: | 88600fa (Commits, GitHub, GitLab) | Commit: | 88600fab14a5499ae54b04cef9538799eb8d9779 |
Dependencies: | Stopgaps: |
Description
$ echo 1+1 | sage
crashes in IPython's prompt_toolkit
Change History (15)
comment:1 Changed 6 years ago by
- Branch set to u/vbraun/crash_when_stdin_is_not_a_tty
comment:2 Changed 6 years ago by
- Commit set to 904c3f775905e04a68c83e31e5641e0e4cb3cd89
- Status changed from new to needs_review
comment:3 Changed 6 years ago by
Is it possible to add a doctest (running echo 1+1 | sage
for example)
comment:4 Changed 6 years ago by
Yes thats already in the branch
comment:5 Changed 6 years ago by
- Status changed from needs_review to needs_work
output
-> out
in the doctest :-)
sage -t --long src/sage/repl/configuration.py ********************************************************************** File "src/sage/repl/configuration.py", line 14, in sage.repl.configuration Failed example: 'In [1]: \n1299709' in out Exception raised: Traceback (most recent call last): File "/home/sage/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run self.compile_and_execute(example, compiler, test.globs) File "/home/sage/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute exec(compiled, globs) File "<doctest sage.repl.configuration[2]>", line 1, in <module> 'In [1]: \n1299709' in out NameError: name 'out' is not defined ********************************************************************** }}}}
comment:6 Changed 6 years ago by
- Commit changed from 904c3f775905e04a68c83e31e5641e0e4cb3cd89 to e205fecc1e9e20de96822d579738d2d9ee018bb8
Branch pushed to git repo; I updated commit sha1. New commits:
e205fec | Fix typo
|
comment:7 Changed 6 years ago by
oops, fixed
comment:8 Changed 6 years ago by
- Status changed from needs_work to needs_review
comment:9 Changed 6 years ago by
The doctest doesn't really test this ticket properly, since the stdout of that doctest isn't a tty either. So the doctest passes even without this ticket. Maybe it's better to run the test in a pexpect
session instead of a subprocess
.
comment:10 Changed 6 years ago by
- Commit changed from e205fecc1e9e20de96822d579738d2d9ee018bb8 to 88600fab14a5499ae54b04cef9538799eb8d9779
Branch pushed to git repo; I updated commit sha1. New commits:
88600fa | Change test so that stdout is a tty
|
comment:11 follow-up: ↓ 12 Changed 6 years ago by
- Status changed from needs_review to needs_work
With this ticket single lines are piping fine, but a multiline one is not:
sc_work@sagecell:~$ echo " > (1+ > 1); > " | /home/sc_serv/sage/sage mkdir: cannot create directory ‘/home/sc_work/.sage//R’: Permission denied /home/sc_serv/sage/src/bin/sage-env: line 465: /home/sc_work/.sage//R/Makevars.user: No such file or directory ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 7.5.beta0, Release Date: 2016-10-21 │ │ Type "notebook()" for the browser-based notebook interface. │ │ Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Warning: this is a prerelease version, and it may be unstable. ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ In [1]: In [1]: File "<ipython-input-1-44a78680af87>", line 1 (Integer(1)+ ^ SyntaxError: unexpected EOF while parsing In [2]: File "<ipython-input-2-414b1b3315a2>", line 1 Integer(1)); ^ SyntaxError: invalid syntax In [3]: In [3]: Exiting Sage (CPU time 0m0.04s, Wall time 0m0.06s).
comment:12 in reply to: ↑ 11 Changed 6 years ago by
comment:13 Changed 6 years ago by
- Status changed from needs_work to needs_review
True, but that's not what this ticket is about.
comment:14 Changed 6 years ago by
- Reviewers set to Jeroen Demeyer
- Status changed from needs_review to positive_review
comment:15 Changed 6 years ago by
- Branch changed from u/vbraun/crash_when_stdin_is_not_a_tty to 88600fab14a5499ae54b04cef9538799eb8d9779
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
Use simple prompt when stdin is not a tty