#352 Fansh: empty input handling

katox Sat 30 Aug 2008

Hi!

I found a minor bug in fansh - it wasn't handling empty input correctly. This patch fixes the issue:

diff --git a/src/fansh/fan/Shell.fan b/src/fansh/fan/Shell.fan
index 7f10a23..6158e45 100644
--- a/src/fansh/fan/Shell.fan
+++ b/src/fansh/fan/Shell.fan
@@ -29,7 +29,12 @@ class Shell
     {
       // input next line
       out.print("fansh> ").flush
 -      line := in.readLine.trim
 +      line := in.readLine
 +
 +      // quit shell on empty input
 +      if (line == null) break
 +
 +      line = line.trim
        if (line.size == 0) continue

We should consider similar errors in Not null by default. This is something to be expected especially when using fluent interfaces. At the same time it is not easily solvable by convenience ?operators.

brian Sun 31 Aug 2008

checked in for next build

Login or Signup to reply.