Rewrite part of snapshot feature to get connections correctly

I've tried to minimize the amount of code I'm touching to complete this. I'd prefer not to rewrite the entire class.
Maybe, but I think it's excessive for no use. This has never been an issue with sspak, which covers every real world use case we have already.
Only capturing the last line wouldn't be great -- I could imagine people wanting to run code that includes newlines and capture the entire output.