}
private Result<IValue> eval (IValue expected, IList commands, IInteger duration, IEvaluatorContext ctx) {
IEvaluator<Result<IValue>> evaluator = ctx.getEvaluator();
EvalTimer timer = new EvalTimer(evaluator, duration.intValue());
Result<IValue> result = null;
timer.start();
if(!timer.hasExpired() && commands.length() > 0){
for(IValue command : commands){
result = evaluator.eval(null, ((IString) command).getValue(), URIUtil.rootScheme("stdin"));
}
timer.cancel();
if (timer.hasExpired()) {
throw RuntimeExceptionFactory.timeout(null, null);
}
if (expected != null) {
Type typ = tr.valueToType((IConstructor) expected);