[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5587] wait for pts device file to appear
From: |
Gavin D. Smith |
Subject: |
[5587] wait for pts device file to appear |
Date: |
Mon, 19 May 2014 21:39:47 +0000 |
Revision: 5587
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5587
Author: gavin
Date: 2014-05-19 21:39:46 +0000 (Mon, 19 May 2014)
Log Message:
-----------
wait for pts device file to appear
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/t/Init-intera.inc
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-05-19 21:24:11 UTC (rev 5586)
+++ trunk/ChangeLog 2014-05-19 21:39:46 UTC (rev 5587)
@@ -1,5 +1,10 @@
2014-05-19 Gavin Smith <address@hidden>
+ * info/t/Init-intera.inc: Confirm pts file exists before redirecting
+ stdin, stdout and stderr.
+
+2014-05-19 Gavin Smith <address@hidden>
+
* info/nodemenu.c (get_visited_nodes): Don't reuse a local
variable for an unrelated purpose. Declared static. Argument
not set to anything other than null in calling code removed. All
Modified: trunk/info/t/Init-intera.inc
===================================================================
--- trunk/info/t/Init-intera.inc 2014-05-19 21:24:11 UTC (rev 5586)
+++ trunk/info/t/Init-intera.inc 2014-05-19 21:39:46 UTC (rev 5587)
@@ -12,12 +12,24 @@
rm -f $GINFO_PTY_FILE
./pseudotty >$GINFO_PTY_FILE &
PTY_PID=$!
-# Wait for pseudotty process to create file
-while test ! -f $GINFO_PTY_FILE;
+
+# Wait for pseudotty process to create file containing name
+# of pts device file to use for input/output.
+while test ! -f $GINFO_PTY_FILE
do
# Sleep for 1 ms if usleep is available
usleep 1000 2>/dev/null || sleep 1
done
-exec >"$(cat $GINFO_PTY_FILE | tr -d '\n')" 2>&1 0<&1
+PTS_DEVICE="$(cat $GINFO_PTY_FILE | tr -d '\n')"
rm -f $GINFO_PTY_FILE
+# Wait for pts device file to actually appear. This shouldn't be
+# necessary, but occasionally we get a "no such file or directory"
+# error when we redirect the file descriptors below.
+while test ! -c $PTS_DEVICE
+do
+ usleep 1000 2>/dev/null || sleep 1
+done
+
+exec 0>$PTS_DEVICE 1<&0 2<&0
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5587] wait for pts device file to appear,
Gavin D. Smith <=