This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

Giving input to EiffelBench produces an exception

Problem

If EiffelBench is executing in the background, for example if it has been started by the command

    ebench &

then entering input from the original terminal window -- corresponding to the input expected by the execution of such routines as read_integer etc. -- may be lost, or even cause an exception.

Fix

The problem will not occur if you keep ebench in the foreground. In other words, start it as just ebench (without the &), or, if it has been started in the background, bring it to the foreground using the Unix fg command.

Discussion

More than an EiffelBench-specific problem this is really a property of Unix: once you have put a process in the background, it has trouble getting its input from the original terminal, since that terminal is also shared by the original (parent process). Input alternatively goes to the parent and to the child; there is no way to guarantee that it only goes to the child, which is what one needs in this case.

The manual (Eiffel: The Environment) is partly to blame, since it suggests using the & form as the default, which is OK as long as the system does not need any input. Future editions will explain this issue clearly.