summaryrefslogtreecommitdiff
path: root/instr-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'instr-client.c')
-rw-r--r--instr-client.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/instr-client.c b/instr-client.c
index fa876fb..fdb5ca2 100644
--- a/instr-client.c
+++ b/instr-client.c
@@ -75,11 +75,20 @@ stdinAvailable (GIOChannel *source, GIOCondition condition, gpointer data)
GError* error = NULL;
- written = g_pollable_output_stream_write_nonblocking(out, tmp, size, NULL, &error);
+ // strip out duplicated newlines and carriage returns
+ GRegex *regex = g_regex_new ("[\\n\\r]+", 0, 0, NULL);
+ gchar *filt = g_regex_replace_literal (regex, tmp, -1, 0, "\n", 0, NULL);
+ g_regex_unref (regex);
+ written = g_pollable_output_stream_write_nonblocking(out, filt, size, NULL, &error);
+
+// written = g_pollable_output_stream_write_nonblocking(out, tmp, size, NULL, &error);
+
if(error != NULL && error->message) {
g_print("Got error: %s\n", error->message);
}
+ g_free (filt);
+
if (written != size || written <= 0) {
g_print("Could not write. blocking. Written: %d\n", written);
return FALSE;