From bb5ee87f44d555c2a39c5aaee81db0ee96020655 Mon Sep 17 00:00:00 2001 From: dteske Date: Sun, 3 Aug 2014 05:02:00 +0000 Subject: [PATCH] Add required `exec' before Xdialog(1) invocation for the case where we expect (require) data on stdin. The effect of this is that, when backgrounded, $! returns the pid of an Xdialog(1) instance instead of an sh(1) instance -- the difference being a later kill of $! will reach the Xdialog(1) instance whereas without the exec the kill succeeds on the sh(1) instance leaving Xdialog(1) open. --- usr.sbin/bsdconfig/share/dialog.subr | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index e887bcad6016..49e72ee575e1 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -1557,12 +1557,22 @@ f_dialog_info() # EOF. This implies that you must execute this either as an rvalue to a pipe, # lvalue to indirection or in a sub-shell that provides data on stdin. # +# To open an Xdialog(1) infobox that does not disappear until expeclitly dis- +# missed, use the following: +# +# f_xdialog_info "$info_text" < /dev/tty & +# pid=$! +# # Perform some lengthy actions +# kill $pid +# +# NB: Check $USE_XDIALOG if you need to support both dialog(1) and Xdialog(1). +# f_xdialog_info() { local info_text="$*" height width f_dialog_infobox_size height width \ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$info_text" - $DIALOG \ + exec $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --no-close --no-buttons \