main: wait for interrupt to finish before ending command invocation
main: wait for interrupt to finish before ending command invocation

If a command invocation such as 'daemon' is interrupted, the interrupt
handler asks the node to close. The closing of the node will result in
the command invocation finishing, and possibly returning from main()
before the interrupt handler is done. In particular, the info logging
that a graceful shutdown was completed may never reach reach stdout.

As the whole point of logging "Gracefully shut down." is to give
confidence when debugging that the shutdown was clean, this is
slightly unfortunate.

The interrupt handler needs to be set up in main() instead of Run(),
so that we can defer the closing of the interrupt handler until just
before returning from main, not when Run() returns with a streaming
result reader.

RX14/go-ipfs,locusf/go-ipfs,liufeiit/go-ipfs,lgierth/go-ipfs,insionng/go-ipfs,liufeiit/go-ipfs,Quantomicus/go-ipfs,interfect/go-ipfs,antonio2718/go-ipfs,Kubuxu/go-ipfs,lgierth/go-ipfs,Quantomicus/go-ipfs,palkeo/go-ipfs,sahib/go-ipfs,kpcyrd/go-ipfs,shaunstanislaus/go-ipfs,ipfs-filestore/go-ipfs,aviau/go-ipfs,bconfais/go-ipfs,shaunstanislaus/go-ipfs,thelinuxkid/go-ipfs,lgierth/go-ipfs,moreati/go-ipfs,shaunstanislaus/go-ipfs,danoctavian/go-ipfs,ehd/go-ipfs,atcsecure/go-ipfs,bussiere/go-ipfs,modong/go-ipfs,MichalPokorny/go-ipfs,LucilleH/go-ipfs,ion1/go-ipfs,rschulman/go-ipfs,OpenBazaar/go-ipfs,davidar/go-ipfs,ianopolous/go-ipfs,keltia/go-ipfs,gatesvp/go-ipfs,RealImage/go-ipfs,WeMeetAgain/go-ipfs,heems/go-ipfs,keltia/go-ipfs,shadoxx/go-ipfs,kpcyrd/go-ipfs,miolini/go-ipfs,ckeenan/go-ipfs,dylanPowers/go-ipfs,sahib/go-ipfs,dylanPowers/go-ipfs,interfect/go-ipfs,klauspost/go-ipfs,heems/go-ipfs,shadoxx/go-ipfs,Luzifer/go-ipfs,palkeo/go-ipfs,keltia/go-ipfs,heems/go-ipfs,AtnNn/go-ipfs,rschulman/go-ipfs,DavidHowlett/go-ipfs,ForrestWeston/go-ipfs,makevoid/go-ipfs,danoctavian/go-ipfs,peersafe/go-ipfs,ion1/go-ipfs,LucilleH/go-ipfs,jefhe2005/ipfs,mantyr/go-ipfs,sroerick/go-ipfs,DavidHowlett/go-ipfs,nchabra/go-ipfs,insionng/go-ipfs,peersafe/go-ipfs,LucilleH/go-ipfs,OpenBazaar/go-ipfs,adrusi/go-ipfs,Stebalien/go-ipfs,insionng/go-ipfs,gatesvp/go-ipfs,code4/go-ipfs,miolini/go-ipfs,Huangyan9188/go-ipfs,Quiark/go-ipfs,ehd/go-ipfs,Luzifer/go-ipfs,sbruce/go-ipfs,danoctavian/go-ipfs,Kubuxu/go-ipfs,davidar/go-ipfs,mjanczyk/go-ipfs,bussiere/go-ipfs,diasdavid/go-ipfs,tswindell/go-ipfs,MichalPokorny/go-ipfs,adrusi/go-ipfs,ckeenan/go-ipfs,wking/go-ipfs,AtnNn/go-ipfs,Huangyan9188/go-ipfs,liufeiit/go-ipfs,Kubuxu/go-ipfs,mildred/go-ipfs,rht/go-ipfs,WilliButz/go-ipfs,ForrestWeston/go-ipfs,klauspost/go-ipfs,kevina/go-ipfs,code4/go-ipfs,ianopolous/go-ipfs,diasdavid/go-ipfs,WeMeetAgain/go-ipfs,rht/go-ipfs,palkeo/go-ipfs,Quiark/go-ipfs,wking/go-ipfs,WilliButz/go-ipfs,RealImage/go-ipfs,mildred/go-ipfs,ipfs-filestore/go-ipfs,tswindell/go-ipfs,willglynn/go-ipfs,kevina/go-ipfs,DavidHowlett/go-ipfs,wking/go-ipfs,RX14/go-ipfs,chriscool/go-ipfs,ehd/go-ipfs,kyledrake/go-ipfs,ion1/go-ipfs,ipfs-filestore/go-ipfs,llawall/go-ipfs,shadoxx/go-ipfs,WilliButz/go-ipfs,mjanczyk/go-ipfs,ianopolous/go-ipfs,gatesvp/go-ipfs,modong/go-ipfs,nchabra/go-ipfs,locusf/go-ipfs,kyledrake/go-ipfs,csasarak/go-ipfs,kyledrake/go-ipfs,MrSparc/go-ipfs,sbruce/go-ipfs,ckeenan/go-ipfs,sahib/go-ipfs,MichaelMure/go-ipfs,chriscool/go-ipfs,moreati/go-ipfs,RealImage/go-ipfs,JustinDrake/go-ipfs,chriscool/go-ipfs,diasdavid/go-ipfs,adrusi/go-ipfs,RX14/go-ipfs,thelinuxkid/go-ipfs,juztamau5/go-ipfs,atcsecure/go-ipfs,Huangyan9188/go-ipfs,thelinuxkid/go-ipfs,sroerick/go-ipfs,david415/go-ipfs,kevina/go-ipfs,aviau/go-ipfs,sbruce/go-ipfs,moreati/go-ipfs,csasarak/go-ipfs,jefhe2005/ipfs,WeMeetAgain/go-ipfs,Quantomicus/go-ipfs,makevoid/go-ipfs,david415/go-ipfs,jefhe2005/ipfs,JustinDrake/go-ipfs,Stebalien/go-ipfs,mantyr/go-ipfs,MrSparc/go-ipfs,interfect/go-ipfs,MichalPokorny/go-ipfs,atcsecure/go-ipfs,rschulman/go-ipfs,mantyr/go-ipfs,modong/go-ipfs,dylanPowers/go-ipfs,davidar/go-ipfs,JustinDrake/go-ipfs,MichaelMure/go-ipfs,AtnNn/go-ipfs,bussiere/go-ipfs,sroerick/go-ipfs,peersafe/go-ipfs,OpenBazaar/go-ipfs,willglynn/go-ipfs,code4/go-ipfs,mjanczyk/go-ipfs,locusf/go-ipfs,llawall/go-ipfs,Stebalien/go-ipfs,MrSparc/go-ipfs,david415/go-ipfs,miolini/go-ipfs,llawall/go-ipfs,antonio2718/go-ipfs,juztamau5/go-ipfs,tswindell/go-ipfs,antonio2718/go-ipfs,ForrestWeston/go-ipfs,Luzifer/go-ipfs,nchabra/go-ipfs,csasarak/go-ipfs,Quiark/go-ipfs,bconfais/go-ipfs,bconfais/go-ipfs,juztamau5/go-ipfs,kpcyrd/go-ipfs,klauspost/go-ipfs,rht/go-ipfs,makevoid/go-ipfs,willglynn/go-ipfs,mildred/go-ipfs,aviau/go-ipfs,MichaelMure/go-ipfs