X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fbin%2Frt.in;h=9cf08fe562df342021e8bd246e33055ca92c950d;hb=refs%2Fheads%2FFREESIDE_2_3_BRANCH;hp=aefe7af727c21221e6868025ec32a13c5ee73b2d;hpb=5fdd19665fb7c0ad425a99d3dbf9ad7e27fbf44a;p=freeside.git diff --git a/rt/bin/rt.in b/rt/bin/rt.in index aefe7af72..9cf08fe56 100644 --- a/rt/bin/rt.in +++ b/rt/bin/rt.in @@ -3,7 +3,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -61,6 +61,7 @@ use HTTP::Request::Common; use HTTP::Headers; use Term::ReadLine; use Time::Local; # used in prettyshow +use File::Temp; # strong (GSSAPI based) authentication is supported if the server does provide # it and the perl modules GSSAPI and LWP::Authen::Negotiate are installed @@ -1473,16 +1474,19 @@ sub read_passwd { sub vi { my ($text) = @_; - my $file = "/tmp/rt.form.$$"; my $editor = $ENV{EDITOR} || $ENV{VISUAL} || "vi"; - local *F; local $/ = undef; - open(F, '>', $file) or die "$file: $!\n"; print F $text; close(F); - system($editor, $file) && die "Couldn't run $editor.\n"; - open(F, '<', $file) or die "$file: $!\n"; $text = ; close(F); - unlink($file); + my $handle = File::Temp->new; + print $handle $text; + close($handle); + + system($editor, $handle->filename) && die "Couldn't run $editor.\n"; + + open( $handle, '<', $handle->filename ) or die "$handle: $!\n"; + $text = <$handle>; + close($handle); return $text; }