summaryrefslogtreecommitdiff
path: root/src/remote.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-08-09 21:45:06 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-08-09 21:45:06 +0100
commitbedf2f703cb3dc97467e662e6750fcd369309e6b (patch)
treeb2913d58ef9735bbc58e8215f977367e00ff09e1 /src/remote.cc
parent3a24763d532f86d38867278229634cd93ddde8a2 (diff)
Small code cleanups
Diffstat (limited to 'src/remote.cc')
-rw-r--r--src/remote.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/remote.cc b/src/remote.cc
index 798b14ee..ca079427 100644
--- a/src/remote.cc
+++ b/src/remote.cc
@@ -548,9 +548,8 @@ void RemoteClient::write_next_key()
void send_command(StringView session, StringView command)
{
int sock = connect_to(session);
- if (::write(sock, command.data(), (int)command.length()) < 0)
- throw runtime_error(format("unable to write data to socket (fd: {}; errno: {})", sock, ::strerror(errno)));
- close(sock);
+ auto close_sock = on_scope_end([sock]{ close(sock); });
+ write(sock, command);
}