Computing the integral $ \lim\limits_{\epsilon\to 0} \int_{-2}^{0} \frac{e^{1/x(x+2)}}{x+1+i\epsilon} $ I got stuck when calculating of this expression
$$
\lim_{\epsilon\rightarrow 0} \int_{-2}^{0} \frac{e^{\frac{1}{x(x+2)}}}{x+1+i\epsilon}
$$
I will be grateful for the advice.
 A: Let $I(\epsilon)$ denote the integral inside the limit. Using the change of variable $z = x+1+i\epsilon$, we have
$$ I(\epsilon) = \int_{-1+i\epsilon}^{1+i\epsilon} \exp\left(-\frac{1}{1-(z-i\epsilon)^2}\right) \, \frac{dz}{z}. $$
Now let
$$ f_{\epsilon}(z) = \frac{1}{z} \exp\left(-\frac{1}{1-(z-i\epsilon)^2}\right). $$
and assume that $\epsilon > 0$. Then by considering a rectangular contour consisting of vertices $\pm 1$ and $\pm  1 + i\epsilon$ with an upper semicircular indent $C^{-}_{\eta}$ of radius $\eta > 0$ at the origin,

we can write
$$ I(\epsilon) = \int_{-1+i\epsilon}^{-1} f_{\epsilon}(z) \, dz + \int_{-1}^{-\eta} f_{\epsilon}(z) \, dz + \int_{C^{-}_{\eta}} f_{\epsilon}(z) \, dz + \int_{\eta}^{1} f_{\epsilon}(z) \, dz + \int_{1}^{1+i\epsilon} f_{\epsilon}(z) \, dz. $$
Now it is easy to confirm that $\left| f_{\epsilon}(z) \right| \leq 1$ for $\Re z = \pm 1$. Thus by taking $\epsilon \to 0^{+}$, it follows that
$$ \lim_{\epsilon \to 0^{+}} I(\epsilon) = \int_{-1}^{-\eta} f_{0}(z) \, dz + \int_{C^{-}_{\eta}} f_{0}(z) \, dz + \int_{\eta}^{1} f_{0}(z) \, dz. $$
But since $f_{0}(z)$ is an odd function, the first integral and the last integral cancel out, yielding
$$ \lim_{\epsilon \to 0^{+}} I(\epsilon) = \int_{C^{-}_{\eta}} f_{0}(z) \, dz. $$
Now taking $\eta \to 0$, we have
$$ \lim_{\epsilon \to 0^{+}} I(\epsilon) = -i\pi \, \mathrm{Res}_{z=0} \, f_{0}(z) = -\frac{i\pi}{e}. $$
Similar consideration yields
$$ \lim_{\epsilon \to 0^{-}} I(\epsilon) = \frac{i\pi}{e}. $$
