Propagate environment from parent process to child

This is required on Linux in order for the child to inherit
the DISPLAY var amongst others.

Also check for the existence of the socket file rather than
the log file, which is created earlier in the hooking process
by the child.