lib/Tools/mkfifo
author haftmann
Wed, 01 Sep 2010 16:08:31 +0200
changeset 39022 ac7774a35bcf
parent 38253 3d4e521014f7
child 39520 bad14b7d0520
permissions -rwxr-xr-x
explicit modify_stmt parameter

#!/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"