Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
917256f9
Commit
917256f9
authored
Jan 12, 2013
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #314 from colah/Ctr-C-D-fix
Fix Ctr-C and Ctr-D behavior.
parents
e73a8a94
d3c1fbaa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
pronsole.py
pronsole.py
+62
-0
No files found.
pronsole.py
View file @
917256f9
...
...
@@ -1253,6 +1253,68 @@ class pronsole(cmd.Cmd):
self
.
onecmd
(
a
)
self
.
processing_args
=
False
# We replace this function, defined in cmd.py .
# It's default behavior with reagrds to Ctr-C
# and Ctr-D doesn't make much sense...
def
cmdloop
(
self
,
intro
=
None
):
"""Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument.
"""
self
.
preloop
()
if
self
.
use_rawinput
and
self
.
completekey
:
try
:
import
readline
self
.
old_completer
=
readline
.
get_completer
()
readline
.
set_completer
(
self
.
complete
)
readline
.
parse_and_bind
(
self
.
completekey
+
": complete"
)
except
ImportError
:
pass
try
:
if
intro
is
not
None
:
self
.
intro
=
intro
if
self
.
intro
:
self
.
stdout
.
write
(
str
(
self
.
intro
)
+
"
\n
"
)
stop
=
None
while
not
stop
:
if
self
.
cmdqueue
:
line
=
self
.
cmdqueue
.
pop
(
0
)
else
:
if
self
.
use_rawinput
:
try
:
line
=
raw_input
(
self
.
prompt
)
except
EOFError
:
print
""
self
.
do_exit
(
""
)
exit
()
except
KeyboardInterrupt
:
print
""
line
=
""
else
:
self
.
stdout
.
write
(
self
.
prompt
)
self
.
stdout
.
flush
()
line
=
self
.
stdin
.
readline
()
if
not
len
(
line
):
line
=
""
else
:
line
=
line
.
rstrip
(
'
\r\n
'
)
line
=
self
.
precmd
(
line
)
stop
=
self
.
onecmd
(
line
)
stop
=
self
.
postcmd
(
stop
,
line
)
self
.
postloop
()
finally
:
if
self
.
use_rawinput
and
self
.
completekey
:
try
:
import
readline
readline
.
set_completer
(
self
.
old_completer
)
except
ImportError
:
pass
if
__name__
==
"__main__"
:
interp
=
pronsole
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment