From fff35d53dedd7915e12d8f5a03b2690c0aa6d275 Mon Sep 17 00:00:00 2001 From: Karchnu Date: Thu, 23 Jul 2020 19:31:30 +0200 Subject: [PATCH] Sending strings. --- src/ipc/context.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ipc/context.cr b/src/ipc/context.cr index 20758ef..3d1c5b8 100644 --- a/src/ipc/context.cr +++ b/src/ipc/context.cr @@ -113,6 +113,10 @@ class IPC::Context send_now message end + def send_now(fd : Int32, utype : UInt8, payload : String) + send_now fd, utype, payload.to_slice + end + def send(message : LibIPC::Message) r = LibIPC.ipc_write(self.pointer, pointerof(message)) if r.error_code != 0 @@ -134,7 +138,7 @@ class IPC::Context end def send(fd : Int32, utype : UInt8, payload : String) - send(fd, utype, Bytes.new(payload.to_unsafe, payload.bytesize)) + send fd, utype, payload.to_slice end def read(index : UInt32)