Ticket #121: eval_win_32.patch

File eval_win_32.patch, 1.6 KB (added by chromatic, 13 years ago)

Explicitly close the temporary file, so that the OS will really close it.

  • src/embed.c

    === src/embed.c
    ==================================================================
     
    440440#endif 
    441441    /* if we've opened a file (or stdin) with PIO, read it in */ 
    442442    if (io) { 
     443        char  *cursor; 
    443444        size_t chunk_size = program_size > 0 ? program_size : 1024; 
    444445        INTVAL wanted     = program_size; 
    445         char  *cursor; 
    446446        size_t read_result; 
    447447 
    448448        program_code = (char *)mem_sys_allocate(chunk_size); 
     
    461461                Parrot_io_eprintf(interp, 
    462462                            "Parrot VM: Could not reallocate buffer " 
    463463                            "while reading packfile from PIO.\n"); 
     464                fclose(io); 
    464465                return NULL; 
    465466            } 
    466467 
  • t/pmc/eval.t

     =item C<void PackFile_fixup_subs>
    === t/pmc/eval.t
    ==================================================================
     
    11#! perl 
    2 # Copyright (C) 2001-2008, The Perl Foundation. 
     2# Copyright (C) 2001-2009, The Perl Foundation. 
    33# $Id$ 
    44 
    55use strict; 
     
    3163162 1 1 1 
    317317OUTPUT 
    318318 
    319 TODO: { 
    320     local $TODO = "cannot 'rm' an open file on windows. TT#121" if $^O =~ /(MSWin32|cygwin)/; 
     319(my $fh, $temp_pbc)  = create_tempfile( SUFFIX => '.pbc', UNLINK => 1 ); 
     320close $fh; 
     321 
    321322pir_output_is( <<"CODE", <<'OUTPUT', "eval.get_string - same file" ); 
    322323.sub main :main 
    323  
    324324  .local pmc f1, f2 
    325325  .local pmc io, os 
    326326  f1 = compi("foo_1", "hello from foo_1") 
     
    358358CODE 
    359359hello from foo_1 
    360360OUTPUT 
    361 } 
    362361 
    363362my (undef, $temp_file) = create_tempfile( UNLINK => 1 ); 
    364363