Bash-it / bash-it

A community Bash framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test battery_percentage with upower fails randomly

NoahGorny opened this issue · comments

see link
it seems like sometimes we get a broken pipe, even without echoing twice..

What do you think @gaelicWizard ?

I think that Bash has a bug with handling SIGPIPE sometimes, but I think that this may work with `echo "$BAT0"$'\n'"/path/to/$RANDOM" so that it's one write. I have that somewhere in another branch I'm trying out.

I suspect that trap '' PIPE may alsö work (install a signal handler, but empty), but I'm reluctant to do any signal handling within BATS without lots of care.

Seems my attempt at echo was part of #2061 and doesn't work. I've added a conservative application of trap '' PIPE to #2031, which seems good so far...

EDIT: nope, that didn't work either...

Ok! New PR #2105 fixes this testing error by avoiding the closed pipe entirely.