comparison piecrust/publishing/shell.py @ 946:8ca228956cc6

publish: Fix shell publisher crash, log `stderr` too.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 05 Oct 2017 00:24:44 -0700
parents 13e8b50a2113
children
comparison
equal deleted inserted replaced
945:b7418025797f 946:8ca228956cc6
28 logger.debug( 28 logger.debug(
29 "Running shell command: %s" % args) 29 "Running shell command: %s" % args)
30 30
31 proc = subprocess.Popen( 31 proc = subprocess.Popen(
32 args, cwd=self.app.root_dir, bufsize=0, 32 args, cwd=self.app.root_dir, bufsize=0,
33 stdout=subprocess.PIPE) 33 stdout=subprocess.PIPE,
34 stderr=subprocess.STDOUT)
34 35
35 logger.debug("Running publishing monitor for PID %d" % proc.pid) 36 logger.debug("Running publishing monitor for PID %d" % proc.pid)
36 thread = _PublishThread(proc) 37 thread = _PublishThread(proc)
37 thread.start() 38 thread.start()
38 proc.wait() 39 proc.wait()
70 71
71 class ShellCommandPublisher(ShellCommandPublisherBase): 72 class ShellCommandPublisher(ShellCommandPublisherBase):
72 PUBLISHER_NAME = 'shell' 73 PUBLISHER_NAME = 'shell'
73 74
74 def _getCommandArgs(self, ctx): 75 def _getCommandArgs(self, ctx):
75 target_cmd = self.getConfigValue('command') 76 target_cmd = self.config.get('command')
76 if not target_cmd: 77 if not target_cmd:
77 raise Exception("No command specified for publish target: %s" % 78 raise Exception("No command specified for publish target: %s" %
78 self.target) 79 self.target)
79 args = shlex.split(target_cmd) 80 args = shlex.split(target_cmd)
80 return args 81 return args