]> diplodocus.org Git - nmh/commitdiff
Set COLUMNS in test-cd if using readline so that its wrapping doesn't
authorDavid Levine <levinedl@acm.org>
Sat, 20 Dec 2014 16:42:11 +0000 (10:42 -0600)
committerDavid Levine <levinedl@acm.org>
Sat, 20 Dec 2014 16:42:11 +0000 (10:42 -0600)
disturb the test output.  The problem arose with a long workspace path.

test/whatnow/test-cd

index 8b01ab6c1d3e107e5323832e88481c88e180d170..e5111bddefd9eb498f7b7842e4c750b9a3f414a9 100755 (executable)
@@ -37,13 +37,17 @@ actual=$MH_TEST_DIR/$$.actual
 set +e
 whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
 set +e
 whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
-
 case ${whatnowtest} in
     cd) cat > "$expected" <<EOF
 cd ${MH_TEST_DIR}/foo\'s\ bar
 pwd
 $SPDIR
 EOF
 case ${whatnowtest} in
     cd) cat > "$expected" <<EOF
 cd ${MH_TEST_DIR}/foo\'s\ bar
 pwd
 $SPDIR
 EOF
+    # If path to $SPDIR is too long, readline will wrap and disturb
+    # the actual output.  It obeys COLUMNS, so set that to a value
+    # that should be longer that $SPDIR plus a bit more.
+    COLUMNS=`getconf PATH_MAX . 2>/dev/null`  ||  COLUMNS=8192
+    export COLUMNS
     ;;
     "") cat > "$expected" <<EOF
 $SPDIR
     ;;
     "") cat > "$expected" <<EOF
 $SPDIR