The problem is that the pengine in test2/0 is waiting to wrap the first answer in the create event, but the first answer doesn't come until after 5 seconds. Now, suppose we had a blocking call instead of sleep/1 - that wouldn't work at all! (Fortunately, pengine_input/2 isn't blocking in a harmful way since it first prompts and it is the prompt that gets wrapped.)
Is this even fixable? If not, the fact that the use of the ask option and the use of pengine_ask/3 aren't always equivalent should perhaps be documented.
Here, test1/0 and test2/0 should ideally behave in exactly the same way, but do not:
The problem is that the pengine in test2/0 is waiting to wrap the first answer in the create event, but the first answer doesn't come until after 5 seconds. Now, suppose we had a blocking call instead of sleep/1 - that wouldn't work at all! (Fortunately, pengine_input/2 isn't blocking in a harmful way since it first prompts and it is the prompt that gets wrapped.)
Is this even fixable? If not, the fact that the use of the ask option and the use of pengine_ask/3 aren't always equivalent should perhaps be documented.