Ensure we handle environment variables properly in all cases.

Signed-off-by: Robin H. Johnson <robbat2@orbis-terrarum.net>