Nicer error message when user tries to use a directory as log file

This commit is contained in:
Kovid Goyal 2017-07-11 10:14:36 +05:30
parent d9c997087e
commit 893b72f0ab
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -190,6 +190,10 @@ def main(args=sys.argv):
raise SystemExit(e.message)
opts.auto_reload_port = int(os.environ.get('CALIBRE_AUTORELOAD_PORT', 0))
opts.allow_console_print = 'CALIBRE_ALLOW_CONSOLE_PRINT' in os.environ
if opts.log and os.path.isdir(opts.log):
raise SystemExit('The --log option must point to a file, not a directory')
if opts.access_log and os.path.isdir(opts.access_log):
raise SystemExit('The --access-log option must point to a file, not a directory')
server = Server(libraries, opts)
if getattr(opts, 'daemonize', False):
if not opts.log and not iswindows: