Skip to content
Permalink
Browse files

Just exit(3) if can't load tasks

  • Loading branch information
ralsina committed May 18, 2017
1 parent 02bfc27 commit b6575850684a547b421c1ccd5902584d05d85137
Showing with 2 additions and 35 deletions.
  1. +2 −35 nikola/__main__.py
@@ -30,10 +30,6 @@
from collections import defaultdict
import os
import shutil

from doit.cmdparse import CmdParseError
from doit.exceptions import InvalidDodoFile, InvalidCommand, InvalidTask

try:
import readline # NOQA
except ImportError:
@@ -289,7 +285,7 @@ def load_tasks(self, cmd, opt_values, pos_args):
signal('initialized').send(self.nikola)
except Exception:
LOGGER.error('Error loading tasks')
raise
sys.exit(3)
return tasks + latetasks, DOIT_CONFIG


@@ -372,36 +368,7 @@ def run(self, cmd_args):
"existing Nikola site.")
return 3
try:

# get "global vars" from cmd-line
args = self.process_args(cmd_args)

# get specified sub-command or use default='run'
if len(args) == 0 or args[0] not in sub_cmds:
specified_run = False
cmd_name = 'run'
else:
specified_run = True
cmd_name = args.pop(0)

# execute command
command = sub_cmds.get_plugin(cmd_name)(
task_loader=self.task_loader,
cmds=sub_cmds,
config=self.config, )

try:
return command.parse_execute(args)

# dont show traceback for user errors.
except (CmdParseError, InvalidDodoFile,
InvalidCommand, InvalidTask) as err:
if isinstance(err, InvalidCommand):
err.cmd_used = cmd_name if specified_run else None
err.bin_name = self.BIN_NAME
sys.stderr.write("ERROR: %s\n" % str(err))
return 3

return super(DoitNikola, self).run(cmd_args)
except Exception:
if self.nikola.debug:
raise

0 comments on commit b657585

Please sign in to comment.
You can’t perform that action at this time.