Intercept return value of _spawn in test function