#!/usr/bin/env python3
+import base64
import errno
import os
import posix
print("Fifo directory %s does not exist!" % fifo_dir, file=sys.stderr)
sys.exit(2)
-if not stat.S_ISFIFO( os.stat(fifo_path).st_mode ):
+if not ( os.path.exists(fifo_path) and
+ stat.S_ISFIFO(os.stat(fifo_path).st_mode) ):
print("Channel %s does not exist!" % sys.argv[1], file=sys.stderr)
sys.exit(3)
+inBytes = sys.stdin.read().encode("UTF-8")
+inB64 = base64.b64encode(inBytes)
+
for i in range(0, 10):
fifo = -1
try:
fifo = posix.open(fifo_path, posix.O_WRONLY | posix.O_NONBLOCK)
- posix.write(fifo, sys.stdin.read().encode())
+ posix.write(fifo, inB64)
sys.exit(0)
except OSError as e:
if e.errno == errno.ENXIO: