lib/Tools/mkfifo
author haftmann
Wed, 11 Aug 2010 17:59:33 +0200
changeset 38383 1ad96229b455
parent 38253 3d4e521014f7
child 39520 bad14b7d0520
permissions -rwxr-xr-x
tuned whitespace

#!/usr/bin/env bash
#
# Author: Makarius
#
# DESCRIPTION: create named pipe


PRG="$(basename "$0")"

function usage()
{
  echo
  echo "Usage: isabelle $PRG"
  echo
  echo "  Create a temporary named pipe and return its name."
  echo
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## main

[ "$#" != 0 ] && usage

#FIXME potential race condition wrt. future processes with same pid
FIFO="/tmp/isabelle-fifo$$"

mkfifo -m 600 "$FIFO" || fail "Failed to create fifo: $FIFO"
echo "$FIFO"