dnschneid/crouton — pull request #525 by drinkcat (2013-12-11 03:28:51+00:00)
Title: Fix bug when -b is specified and groups need to be created/modified.

Steps to reproduce:
```
$ sudo enter-chroot -n precise -u 0 groupdel hwaudio
Entering /usr/local/chroots/precise...
Unmounting /usr/local/chroots/precise...
$ sudo enter-chroot -n precise -b sleep 1
Entering /usr/local/chroots/precise...
Creating hwaudio group with GID 18...
wait: 476: Illegal number:
Unmounting /usr/local/chroots/precise...
```

- env is only redefined after groups ID are checked
- We do not want to silently ignore errors, so moving env redefinition earlier is not a good option
- We fix the problem by checking if $pid is non-empty (should be safe in all cases)