Re: [PATCH] Fix power checking on OS X
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jun 12, 2015, 03:46 UTC
- Message-ID
- <CAPig+cRzKpCePO0gXy7Rok4X7=r6tas28tv48g92YzP9tVP2AA@mail.gmail.com>
- In-Reply-To
- <1434033445-35903-1-git-send-email-pastith@gmail.com>
On Thu, Jun 11, 2015 at 10:37 AM, Panagiotis Astithas <pastith@gmail.com> wrote:
> The output of "pmset -g batt" changed at some point from > "Currently drawing from 'AC Power'" to the slightly different > "Now drawing from 'AC Power'". Starting the match from "drawing" > makes the check work in both old and new versions of OS X.
Would it make sense to try to future-proof this further by searching only for "'AC" (including the leading single-quote) or just "AC" (without the leading quote)?
(Genuine question. I don't have a strong feeling about it.)
Show 17 quoted lines
> Signed-off-by: Panagiotis Astithas <pastith@gmail.com> > --- > diff --git a/contrib/hooks/pre-auto-gc-battery b/contrib/hooks/pre-auto-gc-battery > index 9d0c2d1..6a2cdeb 100755 > --- a/contrib/hooks/pre-auto-gc-battery > +++ b/contrib/hooks/pre-auto-gc-battery > @@ -33,7 +33,7 @@ elif grep -q "AC Power \+: 1" /proc/pmu/info 2>/dev/null > then > exit 0 > elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt | > - grep -q "Currently drawing from 'AC Power'" > + grep -q "drawing from 'AC Power'" > then > exit 0 > fi > -- > 2.4.1