From 20e371c5756ce56c5c7bf5cbf005603665fe1bea Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Mon, 27 Jul 2020 11:03:46 +0300 Subject: [PATCH] Fetch cheat sheets without installing `cht.sh.txt` --- Dockerfile | 6 ++++-- lib/fetch.py | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b74ca1b..347b515 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,9 @@ RUN apk add --update --no-cache python2 py2-pip py2-gevent \ && pip install -r requirements.txt \ && apk del build-deps COPY . /app -RUN apk add --update --no-cache curl git py2-virtualenv \ - && ./share/cht.sh.txt --standalone-install +# fetching cheat sheets +RUN apk add --update --no-cache git \ + && mkdir -p /root/.cheat.sh/log/ \ + && python2 lib/fetch.py fetch-all ENTRYPOINT ["python2"] CMD ["bin/srv.py"] diff --git a/lib/fetch.py b/lib/fetch.py index fb8c951..75a0304 100644 --- a/lib/fetch.py +++ b/lib/fetch.py @@ -56,7 +56,11 @@ def fetch_all(skip_existing=True): sys.stdout.write("Fetching %s..." % (adptr)) sys.stdout.flush() - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + try: + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + except OSError: + print("\nERROR: %s" % cmd) + raise output = process.communicate()[0] if process.returncode != 0: sys.stdout.write("\nERROR:\n---\n" + output)