+ my $our_pid = $$;
+
+ # situation here is wierd, running external app
+ # involves fork+exec. At some point after fork,
+ # but before exec (or during) code can die in a
+ # child. Local is no help here as die throws
+ # error out of scope and locals are reset to old
+ # values. Instead we set values, eval code, check pid
+ # on failure and reset values only in our original
+ # process
+ my ($oldv_dbh, $oldv_rth);
+ my $dbh = $RT::Handle->dbh;
+ $oldv_dbh = $dbh->{'InactiveDestroy'} if $dbh;
+ $dbh->{'InactiveDestroy'} = 1 if $dbh;
+ $oldv_rth = $RT::Handle->{'DisconnectHandleOnDestroy'};
+ $RT::Handle->{'DisconnectHandleOnDestroy'} = 0;
+
+ my ($reader, $writer);
+ pipe( $reader, $writer );