Update Python Nailgun client to handle socket.error exceptions
Update Python Nailgun client to handle socket.error exceptions

Summary: Users on Linux reported the new Python Nailgun client
was leaking `socket.error` exceptions.

This caused the client (at least on Linux) to incorrectly exit with an
error code when shutting down the server, since the server abruptly
closes the socket without sending an exit code when we do that.

This fixes the Python client to turn `socket.error` exceptions
into `NailgunException`s with code `CONNECTION_BROKEN` to mirror
the behavior of the C client.

Now, the Buck wrapper for the Python Nailgun client will correctly
ignore connection broken errors when shutting down the server.

Closes https://github.com/facebook/buck/issues/534

Test Plan: `buck clean; buck build buck` on Mac.
Asked original bug reporters to test patch, they confirmed it
fixed the issue in the Gerrit repo.

Reviewed By: sdwilsh

fb-gh-sync-id: 1d9aa34

Addepar/buck,nguyentruongtho/buck,janicduplessis/buck,marcinkwiatkowski/buck,ilya-klyuchnikov/buck,zhan-xiong/buck,liuyang-li/buck,mogers/buck,Dominator008/buck,bocon13/buck,darkforestzero/buck,davido/buck,clonetwin26/buck,zhan-xiong/buck,shybovycha/buck,LegNeato/buck,romanoid/buck,mikekap/buck,Addepar/buck,bocon13/buck,raviagarwal7/buck,JoelMarcey/buck,marcinkwiatkowski/buck,romanoid/buck,dsyang/buck,Addepar/buck,vine/buck,vschs007/buck,robbertvanginkel/buck,grumpyjames/buck,daedric/buck,mogers/buck,vine/buck,bocon13/buck,k21/buck,rmaz/buck,illicitonion/buck,shybovycha/buck,dsyang/buck,dsyang/buck,mikekap/buck,vine/buck,justinmuller/buck,k21/buck,shs96c/buck,marcinkwiatkowski/buck,marcinkwiatkowski/buck,robbertvanginkel/buck,zhan-xiong/buck,nguyentruongtho/buck,romanoid/buck,shs96c/buck,brettwooldridge/buck,k21/buck,LegNeato/buck,vine/buck,grumpyjames/buck,bocon13/buck,davido/buck,illicitonion/buck,brettwooldridge/buck,shs96c/buck,rmaz/buck,shs96c/buck,justinmuller/buck,LegNeato/buck,SeleniumHQ/buck,robbertvanginkel/buck,rmaz/buck,rmaz/buck,daedric/buck,facebook/buck,clonetwin26/buck,k21/buck,Addepar/buck,sdwilsh/buck,sdwilsh/buck,vine/buck,LegNeato/buck,Dominator008/buck,sdwilsh/buck,grumpyjames/buck,brettwooldridge/buck,clonetwin26/buck,SeleniumHQ/buck,rowillia/buck,dsyang/buck,justinmuller/buck,shs96c/buck,zpao/buck,Dominator008/buck,LegNeato/buck,daedric/buck,justinmuller/buck,rowillia/buck,marcinkwiatkowski/buck,romanoid/buck,LegNeato/buck,mogers/buck,davido/buck,facebook/buck,SeleniumHQ/buck,Addepar/buck,raviagarwal7/buck,sdwilsh/buck,Distrotech/buck,mogers/buck,daedric/buck,rowillia/buck,marcinkwiatkowski/buck,ilya-klyuchnikov/buck,Distrotech/buck,ilya-klyuchnikov/buck,k21/buck,robbertvanginkel/buck,liuyang-li/buck,facebook/buck,zpao/buck,bocon13/buck,romanoid/buck,janicduplessis/buck,zpao/buck,OkBuilds/buck,clonetwin26/buck,daedric/buck,shs96c/buck,darkforestzero/buck,Distrotech/buck,robbertvanginkel/buck,justinmuller/buck,bocon13/buck,sdwilsh/buck,raviagarwal7/buck,brettwooldridge/buck,liuyang-li/buck,raviagarwal7/buck,JoelMarcey/buck,sdwilsh/buck,rmaz/buck,raviagarwal7/buck,justinmuller/buck,clonetwin26/buck,janicduplessis/buck,romanoid/buck,shybovycha/buck,Distrotech/buck,darkforestzero/buck,Addepar/buck,vine/buck,vschs007/buck,rmaz/buck,SeleniumHQ/buck,OkBuilds/buck,raviagarwal7/buck,grumpyjames/buck,sdwilsh/buck,LegNeato/buck,shybovycha/buck,robbertvanginkel/buck,brettwooldridge/buck,vschs007/buck,Addepar/buck,shs96c/buck,davido/buck,LegNeato/buck,mikekap/buck,bocon13/buck,mikekap/buck,kageiit/buck,robbertvanginkel/buck,mikekap/buck,grumpyjames/buck,OkBuilds/buck,brettwooldridge/buck,vschs007/buck,k21/buck,facebook/buck,shybovycha/buck,brettwooldridge/buck,grumpyjames/buck,davido/buck,shybovycha/buck,mogers/buck,dsyang/buck,brettwooldridge/buck,illicitonion/buck,rmaz/buck,grumpyjames/buck,dsyang/buck,illicitonion/buck,rmaz/buck,vschs007/buck,vine/buck,Distrotech/buck,shs96c/buck,nguyentruongtho/buck,romanoid/buck,rowillia/buck,sdwilsh/buck,SeleniumHQ/buck,Addepar/buck,OkBuilds/buck,daedric/buck,janicduplessis/buck,shs96c/buck,daedric/buck,LegNeato/buck,SeleniumHQ/buck,SeleniumHQ/buck,shybovycha/buck,grumpyjames/buck,zhan-xiong/buck,dsyang/buck,robbertvanginkel/buck,illicitonion/buck,robbertvanginkel/buck,kageiit/buck,vine/buck,JoelMarcey/buck,clonetwin26/buck,vschs007/buck,Dominator008/buck,janicduplessis/buck,Dominator008/buck,clonetwin26/buck,Dominator008/buck,janicduplessis/buck,zhan-xiong/buck,OkBuilds/buck,bocon13/buck,clonetwin26/buck,daedric/buck,sdwilsh/buck,bocon13/buck,zhan-xiong/buck,kageiit/buck,kageiit/buck,Addepar/buck,illicitonion/buck,rowillia/buck,vschs007/buck,marcinkwiatkowski/buck,davido/buck,davido/buck,k21/buck,dsyang/buck,shs96c/buck,mikekap/buck,OkBuilds/buck,illicitonion/buck,grumpyjames/buck,bocon13/buck,ilya-klyuchnikov/buck,sdwilsh/buck,raviagarwal7/buck,romanoid/buck,darkforestzero/buck,Addepar/buck,darkforestzero/buck,mogers/buck,brettwooldridge/buck,zhan-xiong/buck,mogers/buck,romanoid/buck,davido/buck,liuyang-li/buck,darkforestzero/buck,dsyang/buck,nguyentruongtho/buck,vschs007/buck,mikekap/buck,mogers/buck,kageiit/buck,sdwilsh/buck,romanoid/buck,clonetwin26/buck,janicduplessis/buck,marcinkwiatkowski/buck,liuyang-li/buck,zhan-xiong/buck,darkforestzero/buck,vschs007/buck,rowillia/buck,brettwooldridge/buck,vschs007/buck,k21/buck,raviagarwal7/buck,justinmuller/buck,janicduplessis/buck,sdwilsh/buck,ilya-klyuchnikov/buck,JoelMarcey/buck,Distrotech/buck,rmaz/buck,illicitonion/buck,rowillia/buck,justinmuller/buck,ilya-klyuchnikov/buck,rowillia/buck,davido/buck,liuyang-li/buck,zhan-xiong/buck,shybovycha/buck,marcinkwiatkowski/buck,k21/buck,JoelMarcey/buck,LegNeato/buck,facebook/buck,SeleniumHQ/buck,zpao/buck,nguyentruongtho/buck,clonetwin26/buck,SeleniumHQ/buck,janicduplessis/buck,rmaz/buck,shybovycha/buck,zpao/buck,shybovycha/buck,rowillia/buck,Distrotech/buck,rowillia/buck,grumpyjames/buck,Distrotech/buck,Addepar/buck,romanoid/buck,raviagarwal7/buck,darkforestzero/buck,davido/buck,dsyang/buck,OkBuilds/buck,zpao/buck,marcinkwiatkowski/buck,kageiit/buck,illicitonion/buck,romanoid/buck,SeleniumHQ/buck,vschs007/buck,k21/buck,ilya-klyuchnikov/buck,facebook/buck,shybovycha/buck,OkBuilds/buck,illicitonion/buck,illicitonion/buck,LegNeato/buck,zhan-xiong/buck,brettwooldridge/buck,sdwilsh/buck,justinmuller/buck,Addepar/buck,bocon13/buck,Addepar/buck,ilya-klyuchnikov/buck,k21/buck,vschs007/buck,JoelMarcey/buck,davido/buck,SeleniumHQ/buck,shybovycha/buck,mikekap/buck,JoelMarcey/buck,rmaz/buck,darkforestzero/buck,raviagarwal7/buck,JoelMarcey/buck,liuyang-li/buck,vine/buck,Dominator008/buck,JoelMarcey/buck,dsyang/buck,zhan-xiong/buck,raviagarwal7/buck,clonetwin26/buck,SeleniumHQ/buck,mikekap/buck,rowillia/buck,vine/buck,k21/buck,darkforestzero/buck,zpao/buck,marcinkwiatkowski/buck,ilya-klyuchnikov/buck,shs96c/buck,Distrotech/buck,LegNeato/buck,JoelMarcey/buck,JoelMarcey/buck,rmaz/buck,janicduplessis/buck,brettwooldridge/buck,raviagarwal7/buck,ilya-klyuchnikov/buck,daedric/buck,liuyang-li/buck,brettwooldridge/buck,dsyang/buck,mogers/buck,mikekap/buck,bocon13/buck,justinmuller/buck,Distrotech/buck,robbertvanginkel/buck,Dominator008/buck,liuyang-li/buck,vschs007/buck,mogers/buck,daedric/buck,ilya-klyuchnikov/buck,liuyang-li/buck,OkBuilds/buck,k21/buck,OkBuilds/buck,rmaz/buck,daedric/buck,shybovycha/buck,JoelMarcey/buck,SeleniumHQ/buck,mogers/buck,darkforestzero/buck,mikekap/buck,zhan-xiong/buck,facebook/buck,vine/buck,marcinkwiatkowski/buck,nguyentruongtho/buck,justinmuller/buck,LegNeato/buck,clonetwin26/buck,Dominator008/buck,zhan-xiong/buck,davido/buck,davido/buck,marcinkwiatkowski/buck,shs96c/buck,darkforestzero/buck,dsyang/buck,mikekap/buck,nguyentruongtho/buck,justinmuller/buck,Dominator008/buck,robbertvanginkel/buck,illicitonion/buck,rowillia/buck,darkforestzero/buck,daedric/buck,daedric/buck,grumpyjames/buck,grumpyjames/buck,Dominator008/buck,shs96c/buck,justinmuller/buck,robbertvanginkel/buck,clonetwin26/buck,OkBuilds/buck,Distrotech/buck,kageiit/buck,OkBuilds/buck,OkBuilds/buck,illicitonion/buck,janicduplessis/buck,Dominator008/buck,ilya-klyuchnikov/buck,raviagarwal7/buck,liuyang-li/buck,janicduplessis/buck,JoelMarcey/buck,robbertvanginkel/buck,romanoid/buck,ilya-klyuchnikov/buck