mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
SF 748975 Printing unsaved shell fails
M IOBinding.py
This commit is contained in:
parent
2f3c74a538
commit
9067c8d85c
1 changed files with 6 additions and 2 deletions
|
@ -459,9 +459,12 @@ class IOBinding:
|
|||
|
||||
def print_window(self, event):
|
||||
tempfilename = None
|
||||
if self.get_saved():
|
||||
saved = self.get_saved()
|
||||
if saved:
|
||||
filename = self.filename
|
||||
else:
|
||||
# shell undo is reset after every prompt, looks saved, probably isn't
|
||||
if not saved or filename is None:
|
||||
# XXX KBK 08Jun03 Wouldn't it be better to ask the user to save?
|
||||
filename = tempfilename = tempfile.mktemp()
|
||||
if not self.writefile(filename):
|
||||
os.unlink(tempfilename)
|
||||
|
@ -479,6 +482,7 @@ class IOBinding:
|
|||
if printPlatform: #we can try to print for this platform
|
||||
command = command % filename
|
||||
pipe = os.popen(command, "r")
|
||||
# things can get ugly on NT if there is no printer available.
|
||||
output = pipe.read().strip()
|
||||
status = pipe.close()
|
||||
if status:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue