lib/Tools/mkfifo
author wenzelm
Mon, 09 Aug 2010 18:18:32 +0200
changeset 38253 3d4e521014f7
parent 29143 72c960b2b83e
child 39520 bad14b7d0520
permissions -rwxr-xr-x
Isabelle_Process: separate input fifo for commands (still using the old tty protocol); some partial workarounds for Cygwin;

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