summaryrefslogtreecommitdiff
path: root/daemon/targetclid
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/targetclid')
-rwxr-xr-xdaemon/targetclid6
1 files changed, 6 insertions, 0 deletions
diff --git a/daemon/targetclid b/daemon/targetclid
index 1265f30..7cec9f4 100755
--- a/daemon/targetclid
+++ b/daemon/targetclid
@@ -46,6 +46,7 @@ class TargetCLI:
self.pid_file = '/var/run/targetclid.pid'
self.NoSignal = True
+ self.sock = None
# shell console methods
self.shell = ConfigShell(getenv("TARGETCLI_HOME", '~/.targetcli'))
@@ -101,6 +102,8 @@ class TargetCLI:
signal handler
'''
self.NoSignal = False
+ if self.sock:
+ self.sock.close()
def try_pidfile_lock(self):
@@ -212,6 +215,9 @@ def main():
to.display(to.render(err.strerror, 'red'))
sys.exit(1)
+ # save socket so a signal can clean it up
+ to.sock = sock
+
# Bind the socket path
try:
sock.bind(to.socket_path)