Fix for Mac OS X compatibility for reading data from child pty.
Extract environment variables from login shell.