mainThe GNU Bourne-Again SHell - Support: sr #110851, extend piupefail to process...

 
 

sr #110851: extend piupefail to process substitution

Submitter:  None
Submitted:  Fri 10 Mar 2023 06:40:46 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 21 Mar 2023 04:03:50 PM UTC, comment #7: 

No, unfortunately we still work on SuSE 12, so this is unavailable for us. But it is not a problem with bash.
Anyway, thanks, I guess this ticket can be closed as already solved.

Anonymous
Tue 21 Mar 2023 01:47:46 PM UTC, comment #6: 

Bash-5.0 was released in 2018. I think nearly five years is enough to be able to use its features.

Chet Ramey <chet>
Group administrator
Tue 21 Mar 2023 09:14:53 AM UTC, comment #5: 

Just a comment:
this issue somehow conflicts with shellcheck, which reports the following message: https://www.shellcheck.net/wiki/SC2312

Anonymous
Tue 21 Mar 2023 08:29:16 AM UTC, comment #4: 


comment #3:

> You can already get the exit code of the process substitution. Process substitution sets $!, so you can wait on that.

ok, thanks (only with bash 5.x).

Anonymous
Mon 20 Mar 2023 01:11:33 PM UTC, comment #3: 

You can already get the exit code of the process substitution. Process substitution sets $!, so you can wait on that.

Chet Ramey <chet>
Group administrator
Mon 20 Mar 2023 06:32:53 AM UTC, comment #2: 

comment #1:

> You're suggesting that the shell should interrogate the subshell about exit statuses of processes that subshell runs? That's not going to work.
>
> The shell where you want PIPESTATUS set only runs one command: read. It forks a subshell for the process substitution, which runs the pipeline.


At least bash can handle the exit code of the subshell. That would be really useful

Anonymous
Tue 14 Mar 2023 07:28:26 PM UTC, comment #1: 

You're suggesting that the shell should interrogate the subshell about exit statuses of processes that subshell runs? That's not going to work.

The shell where you want PIPESTATUS set only runs one command: read. It forks a subshell for the process substitution, which runs the pipeline.

Chet Ramey <chet>
Group administrator
Fri 10 Mar 2023 06:40:46 AM UTC, original submission:  

using:
set -o pipefail
command1 | command2 | grep | sed | read A B C
will set exit code properly if any of the commands fails (and also PIPESTATUS is set).

What I suggest:
set -o pipefail
read A B C < <(command1 | command2 | grep | sed)

should do the same, so both exit code ($?) and PIPESTATUS will be set exactly the same way.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-03-14 chet StatusNone Invalid

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code