#2 `subbash/prompt`: `jobs` output after sourcing `.bashrc` when some jobs are running in the bg or are stopped

Slēgta
tukusejssirs atvēra 6 gadi atpakaļ · 2 komentāri

I like your prompt setting very much, therefore I decided to modify it to my needs.

However, after when I source ~/.bashrc in terminal and have som jobs running either in the background or are stopped, the output of jobs is shown in the terminal, e.g.:

$ source ~/.bashrc
[2]+  Stopped                 nano
[3]-  Running                 firefox &> /dev/null &

The source of the issue is on line 76:

command jobs 2>/dev/null

Is there any other way of catching the exit code of jobs without getting is showed in the terminal? Or what is the purpose of this check? Because the exit code of jobs is 0 regardless of having some jobs in background or stopped jobs.

I like your prompt setting very much, therefore I decided to modify it to my needs. However, after when I source `~/.bashrc` in terminal and have som jobs running either in the background or are stopped, the output of `jobs` is shown in the terminal, e.g.: ```bash $ source ~/.bashrc [2]+ Stopped nano [3]- Running firefox &> /dev/null & ``` The source of the issue is on [line 76](https://notabug.org/demure/dotfiles/src/master/subbash/prompt#L76): ```bash command jobs 2>/dev/null ``` Is there any other way of catching the exit code of `jobs` without getting is showed in the terminal? Or what is the purpose of this check? Because the exit code of `jobs` is `0` regardless of having some jobs in background or stopped jobs.
demure komentēja 6 gadi atpakaļ
Īpašnieks

As I like to sanitize my code, I was trying to check for the jobs builtin existing, but I was treating it like a non builtin. Thanks for pointing this out, as I almost never suspend -- just background and a lot of tmux. I believe that the issue is now corrected with commit 5a189ed970 and the new type jobs &>/dev/null test which will return a 0 for either commands or builtins if found, and a 1 for failure.

Let me know if this is still on fire for you with the new check.

As I like to sanitize my code, I was trying to check for the `jobs` builtin existing, but I was treating it like a non builtin. Thanks for pointing this out, as I almost never suspend -- just background and a lot of tmux. I believe that the issue is now corrected with commit 5a189ed970 and the new `type jobs &>/dev/null` test which will return a 0 for either commands or builtins if found, and a 1 for failure. Let me know if this is still on fire for you with the new check.
tukusejssirs komentēja 6 gadi atpakaļ
Autors

No, there is no issue anymore. In my case, I just deleted the check as I presume that bash shell builtins are always built in.

No, there is no issue anymore. In my case, I just deleted the check as I presume that `bash` shell builtins are _always_ built in.
Pierakstieties, lai pievienotos šai sarunai.
Nav atskaites punktu
Nav atbildīgā
2 dalībnieki
Notiek ielāde...
Atcelt
Saglabāt
Vēl nav satura.