diff options
| author | cah <cah@ableton.com> | 2022-10-04 08:53:45 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-10-04 09:26:00 +0200 |
| commit | e9ac3d457a6b01566cef008dae9ab77059a8652a (patch) | |
| tree | c8eeca60eb8c2d757d839f2071acff25f869e8a6 | |
| parent | 96cbaf54132f8b3c3ebd4b02e44e72034c56965c (diff) | |
Kill docker image on SIGTERM.
| -rwxr-xr-x | cdist | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -29,6 +29,7 @@ import os from pathlib import Path import platform import re +import signal import shlex import shutil import subprocess @@ -549,6 +550,10 @@ class DockerTarget(Target): if config.has('docker_hub_repository'): tag = '%s:%s' % (config.get('docker_hub_repository'), tag) + def signal_handler(signum, frame): + raise Error('Killed') + signal.signal(signal.SIGTERM, signal_handler) + self.container = command_and_read('%s run %s %s -itd %s /bin/bash' % (config.docker(), self._user_tag(), opts, tag))[0].strip() def command(self, cmd): |
