openscad/openscad — Issue #76: Command line argument ignored if file doesn't end in newline
Author: caliston
Created: 2012-01-31 17:11:10+00:00
State: open

When I have a file where the last character isn't a newline, OpenSCAD ignores the first argument on the command line. Consider the code in the file scad-params.scad:

a_a=false;
b_b=false;
c_c=false;
echo("a=",a_a,"b=",b_b,"c=",c_c);
// end of file

If that has the last byte of the file as 'e' running it gives this:

$ openscad -o foo.dxf -D a_a=1 -D b_b=2 scad-params.scad
ECHO: "a=", false, "b=", 2, "c=", false
CGAL Cache insert: group(); (40 bytes)
CGAL Cache insert: group(){group();} (40 bytes)
Current top level object is not a 2D object.

If the 'e' is followed by a newline, ie the last two bytes are 'e\n', it correctly notices the -D a_a=1 argument:

$ openscad -o foo.dxf -D a_a=1 -D b_b=2 scad-params.scad
ECHO: "a=", 1, "b=", 2, "c=", false
CGAL Cache insert: group(); (40 bytes)
CGAL Cache insert: group(){group();} (40 bytes)
Current top level object is not a 2D object.

I'm running a freshly 'git pull'ed OpenSCAD: commit a15c89922e347f6b92e7ddc20e6d5fcd35b207ce, on Ubuntu 11.04, x86.