Skip to content

Commit

Permalink
api: Keep stdout and stderr separate
Browse files Browse the repository at this point in the history
This prevents a rare parse error in case PHP emits a warning, which would mangle
the (also produced) JSON output otherwise.

Signed-off-by: Martin Lehmann <[email protected]>
  • Loading branch information
Wuestengecko committed Nov 10, 2024
1 parent 4603ee1 commit e9062d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nextcloud_news_updater/api/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from subprocess import check_output, CalledProcessError, STDOUT
from subprocess import check_output, CalledProcessError, PIPE
from typing import List, Any

from nextcloud_news_updater.api.api import Api, Feed
Expand All @@ -9,7 +9,7 @@

class Cli:
def run(self, commands: List[str]) -> bytes:
return check_output(commands, stderr=STDOUT)
return check_output(commands, stderr=PIPE)


class CliApi(Api):
Expand Down Expand Up @@ -81,7 +81,7 @@ def run_command(self, command: List[str]) -> None:
self.logger.error("Command '%s' returned %d with output: '%s'" %
(' '. join(command),
e.returncode,
e.output.decode().strip()))
e.stderr.decode().strip()))

def update_feed(self, feed: Feed) -> None:
command = self.api.update_feed_command + [str(feed.feed_id),
Expand Down

0 comments on commit e9062d1

Please sign in to comment.