From d1c74d2160d8705c30cfba937f6cbca01838325a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 5 Mar 2020 17:28:03 +0100 Subject: [PATCH] lib: fix imports being changed every time --- passbook/lib/management/commands/bootstrap.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/passbook/lib/management/commands/bootstrap.py b/passbook/lib/management/commands/bootstrap.py index aa77e213d..50420c9b0 100644 --- a/passbook/lib/management/commands/bootstrap.py +++ b/passbook/lib/management/commands/bootstrap.py @@ -1,10 +1,10 @@ """passbook management command to bootstrap""" from argparse import REMAINDER from subprocess import Popen # nosec - -# pylint: disable=redefined-builtin -from sys import exit, stderr, stdin, stdout +from sys import stderr, stdin, stdout +from sys import exit as _exit from time import sleep +from typing import List from django.core.management.base import BaseCommand from django.db import connection @@ -54,13 +54,12 @@ class Command(BaseCommand): should_check = not (self.check_database() and self.check_cache()) sleep(1) LOGGER.info("Dependencies are up, starting command...") - proc = Popen( - args=options.get("command"), stdout=stdout, stderr=stderr, stdin=stdin - ) # nosec + commands: List[str] = options.get("command", ["exit", "1"]) + proc = Popen(args=commands, stdout=stdout, stderr=stderr, stdin=stdin) # nosec try: proc.wait() - exit(proc.returncode) + _exit(proc.returncode) except KeyboardInterrupt: LOGGER.info("Killing process") proc.kill() - exit(254) + _exit(254)