syswrite() was still returning byte counts, not character counts.
[p5sagit/p5-mst-13.2.git] / t / test.pl
index 9a95de1..e4411af 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -199,13 +199,13 @@ sub _quote_args {
 sub runperl {
     my %args = @_;
     my $runperl = $^X;
-    if (defined $args{switches}) {
+    if ($args{switches}) {
        _quote_args(\$runperl, $args{switches});
     }
-    unless (defined $args{nolib}) {
-       if ($is_macos && $args{stderr}) {
+    unless ($args{nolib}) {
+       if ($is_macos) {
            $runperl .= ' -I::lib';
-           # Use UNIX style error message instead of MPW style.
+           # Use UNIX style error messages instead of MPW style.
            $runperl .= ' -MMac::err=unix' if $args{stderr};
        }
        else {
@@ -223,12 +223,17 @@ sub runperl {
        $runperl .= qq( "$args{progfile}");
     }
     if (defined $args{stdin}) {
+        # so we don't try to put literal newlines and crs onto the
+        # command line.
+        $args{stdin} =~ s/\n/\\n/g;
+        $args{stdin} =~ s/\r/\\r/g;
+
        if ($is_mswin || $is_netware || $is_vms) {
-           $runperl = qq{$^X -e "print q(} .
+           $runperl = qq{$^X -e "print qq(} .
                $args{stdin} . q{)" | } . $runperl;
        }
        else {
-           $runperl = qq{$^X -e 'print q(} .
+           $runperl = qq{$^X -e 'print qq(} .
                $args{stdin} . q{)' | } . $runperl;
        }
     }