lib/Tools/mkfifo
author wenzelm
Fri, 12 Dec 2008 12:14:02 +0100
changeset 29088 95a239a5e055
parent 28650 a7ba12e0d3b7
child 29143 72c960b2b83e
permissions -rwxr-xr-x
future proofs: more robust check via Future.enabled;

#!/usr/bin/env bash
#
# $Id$
# 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

FIFO="/tmp/isabelle-fifo$$"
mkfifo -m 600 "$FIFO" || fail "Failed to create named pipe $FIFO"
echo "$FIFO"