allow custom function for phantom stdout and stderr