Edgewall Software
Modify

Opened 7 years ago

Last modified 7 months ago

#12903 new defect

Should catch KeyboardInterrupt when initenv is invoked via command line

Reported by: Jun Omae Owned by:
Priority: normal Milestone: next-stable-1.6.x
Component: admin/console Version: 1.0.15
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When initenv is invoked via command line and entering CTRL-C on prompt for project name, KeyboardInterrupt is raised. I think we should catch the KeyboardInterrupt error.

$ /venv/trac/1.2.2/bin/trac-admin /tmp/test-test-test initenv
Creating a new Trac environment at /tmp/test-test-test

Trac will first ask a few questions about your environment
in order to initialize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> Traceback (most recent call last):
  File "/venv/trac/1.2.2/bin/trac-admin", line 9, in <module>
    load_entry_point('Trac==1.2.2', 'console_scripts', 'trac-admin')()
  File "/venv/trac/1.2.2/lib/python2.6/site-packages/trac/admin/console.py", line 647, in run
    return _run(args)
  File "/venv/trac/1.2.2/lib/python2.6/site-packages/trac/admin/console.py", line 632, in _run
    return admin.onecmd(' '.join(_quote_args(args[1:])))
  File "/venv/trac/1.2.2/lib/python2.6/site-packages/trac/admin/console.py", line 112, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.6/cmd.py", line 219, in onecmd
    return func(arg)
  File "/venv/trac/1.2.2/lib/python2.6/site-packages/trac/admin/console.py", line 459, in do_initenv
    project_name, db_str = self.get_initenv_args()
  File "/venv/trac/1.2.2/lib/python2.6/site-packages/trac/admin/console.py", line 399, in get_initenv_args
    default=dp)).strip() or dp)
  File "/venv/trac/1.2.2/lib/python2.6/site-packages/trac/util/text.py", line 294, in raw_input
    return to_unicode(__builtin__.raw_input(), sys.stdin.encoding)
KeyboardInterrupt

However, KeyboardInterrupt is not raised when initenv is invoked in trac-admin console and entering CTRL-C.

$ /venv/trac/1.2.2/bin/trac-admin /tmp/test-test-test
Welcome to trac-admin 1.2.2
Interactive Trac administration console.
Copyright (C) 2003-2013 Edgewall Software

Type:  '?' or 'help' for help on commands.

Trac [/tmp/test-test-test]> initenv
Creating a new Trac environment at /tmp/test-test-test

Trac will first ask a few questions about your environment
in order to initialize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]>
$ 

Attachments (0)

Change History (2)

comment:1 by Ryan J Ollos, 4 years ago

Milestone: next-stable-1.2.xnext-stable-1.4.x

comment:2 by Ryan J Ollos, 7 months ago

Milestone: next-stable-1.4.xnext-stable-1.6.x

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.