# __DRIVER_CODE__ imports

cdef extern from "<sys/types.h>":
  ctypedef unsigned short mode_t
cdef extern from "<sys/stat.h>":
  int mkfifo(const char *, mode_t)


# __DRIVER_CODE__ variables

cdef int named_pipe
cdef const char *FIFOFILE = '{{out_signal['args']['filepath']}}'

# temporary pointer to pass to output APIs
cdef uint8_t *outBuf
cdef size_t sentBytes
cdef size_t outBufLen


# __DRIVER_CODE__ setup

# __DRIVER_CODE__ write

  if(outBufLen > 0):
    if(write(named_pipe, outBuf, outBufLen) == -1):
      die("Pipe Write Failed \n") 

# __DRIVER_CODE__ exit_handler
  close(named_pipe)
  remove(FIFOFILE)
