The reason you need to pause is to ensure that the piped code runs afterwards and in the same context as the repl. The corner case that demands deferring the event is when the script itself tries to read from stdin. 

The other approach (create context, exec code from file, create repl using the new context) required a try-catch block to prevent exceptions in the source file from ending the session before executing code from stdin. that is another alternative if you think the proposed approach is not ideal.