print comamnd output in error case
This commit is contained in:
parent
1ab39431a0
commit
f4f94be674
1 changed files with 14 additions and 6 deletions
|
@ -2,15 +2,23 @@
|
||||||
|
|
||||||
from os import environ
|
from os import environ
|
||||||
from flask import Flask, request
|
from flask import Flask, request
|
||||||
from subprocess import check_output
|
from subprocess import check_output, CalledProcessError
|
||||||
import json
|
import json
|
||||||
|
from sys import stderr
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/<strategy>', methods=['POST'])
|
@app.route('/<strategy>', methods=['POST'])
|
||||||
def build(strategy):
|
def build(strategy):
|
||||||
return check_output([
|
try:
|
||||||
f"/{environ['STRATEGIES_DIR']}/{strategy}",
|
return check_output([
|
||||||
json.dumps(request.get_json(), sort_keys=True, indent=4),
|
f"{environ['STRATEGIES_DIR']}/{strategy}",
|
||||||
json.dumps(request.args.to_dict()),
|
json.dumps(request.get_json(), sort_keys=True, indent=4),
|
||||||
])
|
json.dumps(request.args.to_dict()),
|
||||||
|
])
|
||||||
|
except CalledProcessError as error:
|
||||||
|
print(error.stdout, file=stderr)
|
||||||
|
print(error.stderr, file=stderr)
|
||||||
|
|
||||||
|
raise error
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue