Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15861
| From | Manish Patel <manish.patel2@broadcom.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | print/echo lost from COMMAND_PROMPT Function |
| Date | 2020-02-03 15:26 -0500 |
| Message-ID | <mailman.239.1580765552.2412.bug-bash@gnu.org> (permalink) |
| References | <cb99a479-dbf5-462d-191c-bb77aa896fd4@broadcom.com> |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib
-Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fdebug-prefix-map=/build/bash-N2nMjo/bash-4.4.18=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux bsec-and-01 5.0.0-37-generic #40~18.04.1-Ubuntu SMP
Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.4
Patch Level: 20
Release Status: release
Description:
Print/echo is lost when generated from a function in
COMMAND_PROMPT and placed in background in subshell.
I have embedded some git information in my command prompt.
However, due to large git data, it takes some time to calculate it all.
So I have placed
the git processing in the background function, which I call from
COMMAND_PROMPT.
Repeat-By:
[Describe the sequence of events that causes the problem
to occur.]
===== Test sourcing this file ========
# Below code works on bash-4.3.48(1)
# breaks on bash 4.4.20(1)
# When working I expect following behavior
# If I hit "ENTER" on command line, my prompt
# looks like:
# *[]$
# After some time when background processing is done, it updates as:
# []$
#
# on Bash 4.4.20(1), prompt never updates. "*" never goes away.
PS1="*[]$"
PROMPT_COMMAND="setps"
long_process()
{
# Here I do all my git processing (replacing with empty computing for
you to reproduce)
cnt=1000
while [ $cnt != 0 ]
do
ls -l > /dev/null
(( cnt-- ))
done
tput sc
echo -en "\r "
tput rc
}
setps()
{
(long_process &)
}
==========================
If I don't create a subshell, i.e. "long_process &"
I get annoying "Done" on bash 4.3:
[1] Done long_process
But bash 4.4 simply stops it:
[1]+ Stopped long_process
Please help me with this.
Thank you
Manish.
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
print/echo lost from COMMAND_PROMPT Function Manish Patel <manish.patel2@broadcom.com> - 2020-02-03 15:26 -0500
csiph-web