bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`jobs` shows output even when nothing has been started in the background


From: Ajeet D'Souza
Subject: `jobs` shows output even when nothing has been started in the background
Date: Wed, 14 Jun 2023 14:17:46 +0530

*Configuration Information [Automatically generated, do not change]:*
Machine: aarch64
OS: darwin22.1.0
Compiler: clang
Compilation CFLAGS: -DSSH_SOURCE_BASHRC
uname output: Darwin ip-192-168-0-101.ap-south-1.compute.internal 22.3.0
Darwin Kernel Version 22.3.0: Thu Jan  5 20:48:54 PST 2023;
root:xnu-8792.81.2~2/RELEASE_ARM64_T6000 arm64
Machine Type: aarch64-apple-darwin22.1.0

Bash Version: 5.2
Patch Level: 15
Release Status: release

*Description:*
I apologize if this is not a bug, but I couldn't find any documentation
around this behaviour.

In Bash, this does not produce any output:
/bin/echo; jobs -l

But if you run it in a subshell, it does:
(/bin/echo; jobs -l) # output: [1]  42135 Done                    /bin/echo

Similar problem if you put this into $PROMPT_COMMAND, although it does not
run in a subshell AFAIK:
PROMPT_COMMAND='/bin/echo; jobs -l' # output on every prompt: [1]  42135
Done                    /bin/echo

This happens only for external processes, if you were to use the builtin
echo, it would not show any background process. However, in all 3 cases,
the applications have been started normally in the foreground, but somehow
the behaviour is different. I have two questions here:

   - Is this a bug, or is this expected behavior?
   - Is there a way I can start an external process in $PROMPT_COMMAND without
   it showing up in jobs?

Context: I'm the maintainer of zoxide
<https://github.com/ajeetdsouza/zoxide> (a Bash plugin), and this behavior
is causing it to clash with the jobs indicator of starship
<https://github.com/starship/starship> (a popular prompt). This issue
should provide more information:
https://github.com/starship/starship/issues/5159

*Repeat-By:*
This command ideally should not have any output:
(/bin/echo; jobs -l)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]