Adopted from Michael Beer -- GH pull-request #232 with minor changes:
* rebased on master,
* removed trailing whitespace,
* don't explicitly change saved configuration defaults (wscript)
* moved sys/wait (WNOHANG) to header include
* separate changes in GUI and lib