diff -ru parrot/config/gen/platform/win32/exec.c parrot-mod/config/gen/platform/win32/exec.c --- parrot/config/gen/platform/win32/exec.c 2005-07-22 09:23:49.418830400 -0500 +++ parrot-mod/config/gen/platform/win32/exec.c 2005-07-22 12:35:17.030444800 -0500 @@ -63,22 +63,21 @@ if (pmclen == 0) { internal_exception(NOSPAWN, "Empty argument array for spawnw"); } - + /* Now build command line. */ for (i = 0; i < pmclen; i++) { - STRING *s = VTABLE_get_string_keyed_int(interpreter, cmdargs, i); - char *cs = string_to_cstring(interpreter, s); - if (cmdlinepos + s->strlen + 3 > cmdlinelen) - { - cmdlinelen += s->strlen + 4; - mem_sys_realloc(cmdline, cmdlinelen); + STRING *s = VTABLE_get_string_keyed_int(interpreter, cmdargs, i); + char *cs = string_to_cstring(interpreter, s); + if (cmdlinepos + s->strlen + 3 > cmdlinelen) { + cmdlinelen += s->strlen + 4; + cmdline = mem_sys_realloc(cmdline, cmdlinelen); } strcpy(cmdline + cmdlinepos, "\""); strcpy(cmdline + cmdlinepos + 1, cs); strcpy(cmdline + cmdlinepos + 1 + s->strlen, "\" "); cmdlinepos += s->strlen + 3; } - + /* Start the child process. */ memset(&si, 0, sizeof(si)); si.cb = sizeof(si); diff -ru parrot/t/op/spawnw.t parrot-mod/t/op/spawnw.t --- parrot/t/op/spawnw.t 2005-07-19 08:34:56.005030400 -0500 +++ parrot-mod/t/op/spawnw.t 2005-07-22 12:53:26.052388600 -0500 @@ -34,7 +34,7 @@ =cut -use Parrot::Test tests => 6; +use Parrot::Test tests => 7; # perl command coded this way to avoid platform # quoting issue. @@ -132,3 +132,31 @@ CODE return code: 3 OUTPUT + +pir_output_is(<<'CODE', <<'OUTPUT', "grow argv buffer"); +.sub test @MAIN + .local pmc args + + $S0 = "exit length(qq{" + $I0 = 0 +loop: + if $I0 >= 1000 goto end + $S0 = concat $S0, "A" + inc $I0 + branch loop +end: + $S0 = concat $S0, "}) / 100" + new args, .PerlArray + push args, "perl" + push args, "-e" + push args, $S0 + $I0 = spawnw args + shr $I1, $I0, 8 + print "return code: " + print $I1 + print "\n" + end +.end +CODE +return code: 10 +OUTPUT