mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
added custom logger for subprocess
This commit is contained in:
parent
0136671bb4
commit
4e4c69d660
1 changed files with 14 additions and 7 deletions
|
|
@ -55,14 +55,21 @@ class PublishImageSequence(pyblish.api.Extractor):
|
|||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
|
||||
output, error = process.communicate()
|
||||
while True:
|
||||
output = process.stdout.readline()
|
||||
# Break when there is no output or a return code has been given
|
||||
if output == '' and process.poll() is not None:
|
||||
break
|
||||
if output:
|
||||
line = output.strip()
|
||||
if line.startswith("ERROR"):
|
||||
self.log.error(line)
|
||||
else:
|
||||
self.log.info(line)
|
||||
|
||||
if output:
|
||||
self.log.info(output)
|
||||
|
||||
if error:
|
||||
self.log.error(error)
|
||||
raise RuntimeError(error)
|
||||
if process.returncode != 0:
|
||||
raise RuntimeError("Process quit with non-zero "
|
||||
"return code: {}".format(process.returncode))
|
||||
|
||||
# todo: ensure publish went without any issues
|
||||
valid = bool(context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue