lib: fix imports being changed every time

This commit is contained in:
Jens Langhammer 2020-03-05 17:28:03 +01:00
parent f2119ce567
commit d1c74d2160
1 changed files with 7 additions and 8 deletions

View File

@ -1,10 +1,10 @@
"""passbook management command to bootstrap""" """passbook management command to bootstrap"""
from argparse import REMAINDER from argparse import REMAINDER
from subprocess import Popen # nosec from subprocess import Popen # nosec
from sys import stderr, stdin, stdout
# pylint: disable=redefined-builtin from sys import exit as _exit
from sys import exit, stderr, stdin, stdout
from time import sleep from time import sleep
from typing import List
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db import connection from django.db import connection
@ -54,13 +54,12 @@ class Command(BaseCommand):
should_check = not (self.check_database() and self.check_cache()) should_check = not (self.check_database() and self.check_cache())
sleep(1) sleep(1)
LOGGER.info("Dependencies are up, starting command...") LOGGER.info("Dependencies are up, starting command...")
proc = Popen( commands: List[str] = options.get("command", ["exit", "1"])
args=options.get("command"), stdout=stdout, stderr=stderr, stdin=stdin proc = Popen(args=commands, stdout=stdout, stderr=stderr, stdin=stdin) # nosec
) # nosec
try: try:
proc.wait() proc.wait()
exit(proc.returncode) _exit(proc.returncode)
except KeyboardInterrupt: except KeyboardInterrupt:
LOGGER.info("Killing process") LOGGER.info("Killing process")
proc.kill() proc.kill()
exit(254) _exit(254)