Skip to content

Commit

Permalink
server: fix import of CalledProcessError from subprocess
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sokołowski <jakub@status.im>
  • Loading branch information
jakubgs committed Sep 27, 2023
1 parent 4d4f8f2 commit 01bed38
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions files/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from flask import Flask
from git import Repo, util
from webhook import Webhook
from subprocess import check_output
from os import environ as env, path
from urllib.parse import urlparse
from argparse import ArgumentParser
from subprocess import check_output, CalledProcessError

app = Flask(__name__)
webhook = Webhook(app, endpoint='/gh_webhook')
Expand Down Expand Up @@ -85,14 +85,14 @@ def remove_prefix(text, prefix):
return text[text.startswith(prefix) and len(prefix):]

def run_command(command):
log.info('Running command: %s' % command)
log.info('Running command: %s', command)
try:
output = check_output(command.split())
except subprocess.CalledProcessError as err:
except CalledProcessError as err:
log.error('Command failed, return code: %d' % err.returncode)
log.error('Command stdout:\n%s' % err.output)
log.error('Command stdout:\n%s', err.output)
else:
log.info('Command success:\n%s' % output)
log.info('Command success:\n%s', output)

def define_push_hook(repo, post_action):
@webhook.hook()
Expand Down

0 comments on commit 01bed38

Please sign in to comment.