author | wenzelm |
Sat, 18 Sep 2010 17:39:23 +0200 | |
changeset 39520 | bad14b7d0520 |
parent 38253 | 3d4e521014f7 |
child 39521 | 7ed922d15827 |
permissions | -rwxr-xr-x |
28047 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# Author: Makarius |
|
4 |
# |
|
5 |
# DESCRIPTION: create named pipe |
|
6 |
||
7 |
||
8 |
PRG="$(basename "$0")" |
|
9 |
||
10 |
function usage() |
|
11 |
{ |
|
12 |
echo |
|
39520
bad14b7d0520
Isabelle_System.mk_fifo: more robust enumeration of unique names, based on persisting JVM pid (parent of shell process);
wenzelm
parents:
38253
diff
changeset
|
13 |
echo "Usage: isabelle $PRG [SUFFIX]" |
28047 | 14 |
echo |
15 |
echo " Create a temporary named pipe and return its name." |
|
16 |
echo |
|
17 |
exit 1 |
|
18 |
} |
|
19 |
||
20 |
function fail() |
|
21 |
{ |
|
22 |
echo "$1" >&2 |
|
23 |
exit 2 |
|
24 |
} |
|
25 |
||
26 |
||
27 |
## main |
|
28 |
||
39520
bad14b7d0520
Isabelle_System.mk_fifo: more robust enumeration of unique names, based on persisting JVM pid (parent of shell process);
wenzelm
parents:
38253
diff
changeset
|
29 |
SUFFIX="" |
bad14b7d0520
Isabelle_System.mk_fifo: more robust enumeration of unique names, based on persisting JVM pid (parent of shell process);
wenzelm
parents:
38253
diff
changeset
|
30 |
[ "$#" != 0 ] && { SUFFIX="-$1"; shift; } |
bad14b7d0520
Isabelle_System.mk_fifo: more robust enumeration of unique names, based on persisting JVM pid (parent of shell process);
wenzelm
parents:
38253
diff
changeset
|
31 |
|
28047 | 32 |
[ "$#" != 0 ] && usage |
33 |
||
39520
bad14b7d0520
Isabelle_System.mk_fifo: more robust enumeration of unique names, based on persisting JVM pid (parent of shell process);
wenzelm
parents:
38253
diff
changeset
|
34 |
FIFO="/tmp/isabelle-fifo${PPID}${SUFFIX}" |
38253
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
wenzelm
parents:
29143
diff
changeset
|
35 |
|
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
wenzelm
parents:
29143
diff
changeset
|
36 |
mkfifo -m 600 "$FIFO" || fail "Failed to create fifo: $FIFO" |
28047 | 37 |
echo "$FIFO" |