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"""
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)