gm
gm copied to clipboard
Do not clear timeout if proc's exitCode is null
I have ImageMagick 6.9.9-9 installed locally and in some case I found that the spawned child process for calling ImageMagick hangs forever and thus calling gm.toBuffer never return, I know this is an issure form ImageMagick but in this case I expect the gm library to kill the spawned process when the timeout option is given. I found that the timer in the cb function get cleared regardless of the exit code from the spawned process. This fix adds check to make sure the timer only get cleared if there is a valid exit code from the spawned process, otherwise the timeout function will be trigged to kill the spawned process after the timeout value elapses.
Tests failed due to getaddrinfo-enotfound not relevant to code change
please add a test