Intercept return value of _spawn in test functoin