Changeset 24429 for gs2-extensions
- Timestamp:
- 2011-08-19T13:07:27+12:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/tdb-edit/trunk/src/perllib/dbutil/tdb.pm
r24069 r24429 32 32 33 33 # Libraries/Modules 34 use Cwd; 34 35 use dbutil::gdbmtxtgz; 35 36 … … 38 39 # ----------------------------------------------------------------------------- 39 40 41 our %handle_pool; 42 43 END { 44 # Close any handles left open in the pool 45 foreach my $pool_key (keys %handle_pool) 46 { 47 my $infodb_file_handle = $handle_pool{$pool_key}; 48 close_infodb_write_handle($infodb_file_handle, 1); 49 } 50 } 51 40 52 # /** 41 53 # */ … … 44 56 my $program = shift(@_); 45 57 my $program_exe = &util::filename_cat($program . &util::get_os_exe()); 46 if (!-x $program_exe)47 {48 die('Fatal Error! File doesn\'t exist or isn\'t executable: ' . $program_exe);49 }58 #if (!-x $program_exe) 59 #{ 60 # die('Fatal Error! File doesn\'t exist or isn\'t executable: ' . $program_exe); 61 #} 50 62 return $program_exe; 51 63 } 52 64 # /** get_tdb_executable() **/ 53 65 66 67 54 68 # /** 55 69 # */ … … 61 75 my $txt2tdb_exe = &dbutil::tdb::get_tdb_executable('txt2tdb'); 62 76 77 my $pool_key = $infodb_file_path; 78 #my $cmd = "taskset -c 5 \"$txt2tdb_exe\""; 63 79 my $cmd = "\"$txt2tdb_exe\""; 64 80 if ((defined $opt_append) && ($opt_append eq "append")) 65 81 { 66 82 $cmd .= " -append"; 83 $pool_key .= '-append'; 67 84 } 68 85 $cmd .= " \"$infodb_file_path\""; 86 #$cmd .= " -debug"; # Uncomment to enable debug timing 69 87 70 88 # we're going to pipe the key value pairs, in the appropriate format, from 71 89 # within the buildproc, so we create a piped handle here 72 90 my $infodb_file_handle = undef; 73 if(!open($infodb_file_handle, "| $cmd")) 74 { 75 print STDERR "Error: Failed to open pipe to $cmd\n"; 76 print STDERR " $!\n"; 77 return undef; 78 } 79 80 binmode($infodb_file_handle,":utf8"); 81 91 if (defined $handle_pool{$pool_key}) 92 { 93 $infodb_file_handle = $handle_pool{$pool_key}; 94 } 95 else 96 { 97 print STDERR "tdb::open_infodb_write_handle()\n"; 98 if(!open($infodb_file_handle, "| $cmd")) 99 { 100 print STDERR "Error: Failed to open pipe to $cmd\n"; 101 print STDERR " $!\n"; 102 return undef; 103 } 104 binmode($infodb_file_handle,":utf8"); 105 $handle_pool{$pool_key} = $infodb_file_handle; 106 } 82 107 return $infodb_file_handle; 83 108 } … … 89 114 { 90 115 my $infodb_handle = shift(@_); 91 close($infodb_handle); 116 my ($empty_pool) = @_; 117 if (defined $empty_pool && $empty_pool == 1) 118 { 119 print STDERR "tdb::close_infodb_write_handle()\n"; 120 close($infodb_handle); 121 } 92 122 } 93 123 # /** close_infodb_write_handle() **/
Note:
See TracChangeset
for help on using the changeset viewer.