summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2019-10-10 13:33:07 -0700
committerLee Duncan <lduncan@suse.com>2019-10-10 13:33:07 -0700
commit106c705d90602ee1b74df9d4e485d0df93befd79 (patch)
treef44ad73a11a708dcf790fcc8456d36b08d800cbd /daemon
parenta78375d3baf0183a74da12c971b5513791aa63f2 (diff)
downloadtargetcli-106c705d90602ee1b74df9d4e485d0df93befd79.tar.gz
Only return response to targetcli when bytes present
There's no need to return a zero-length string. Before being fixed, this caused a hang when shutting down.
Diffstat (limited to 'daemon')
-rwxr-xr-xdaemon/targetclid6
1 files changed, 3 insertions, 3 deletions
diff --git a/daemon/targetclid b/daemon/targetclid
index 29ad07a..980e420 100755
--- a/daemon/targetclid
+++ b/daemon/targetclid
@@ -162,10 +162,10 @@ class TargetCLI:
with open('/tmp/data.txt', 'r') as f:
output = f.read()
-
var = struct.pack('i', len(output))
- connection.sendall(var) # length of string
- connection.sendall(output.encode()) # actual string
+ connection.sendall(var) # length of string
+ if len(output):
+ connection.sendall(output.encode()) # actual string
def usage():