From 7a3f89cfa554e2af005a43334e2080f89fe45cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sen=C3=ADn?= Date: Mon, 18 Nov 2019 10:26:26 +0100 Subject: [PATCH] Do not process empty lines or commented at Procfile --- piku.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/piku.py b/piku.py index d7ae87b..2380341 100755 --- a/piku.py +++ b/piku.py @@ -246,13 +246,17 @@ def parse_procfile(filename): workers = {} if not exists(filename): return None + with open(filename, 'r') as procfile: - for line in procfile: + for line_number, line in enumerate(procfile): + line = line.strip() + if line.startswith("#") or not line: + continue try: kind, command = map(lambda x: x.strip(), line.split(":", 1)) workers[kind] = command except: - echo("Warning: unrecognized Procfile entry '{}'".format(line), fg='yellow') + echo("Warning: unrecognized Procfile entry '{}' at line {}".format(line, line_number), fg='yellow') if not len(workers): return {} # WSGI trumps regular web workers