Fix pgindent --show-diff option.
authorTom Lane <[email protected]>
Mon, 23 Jan 2023 18:50:49 +0000 (13:50 -0500)
committerTom Lane <[email protected]>
Mon, 23 Jan 2023 18:50:49 +0000 (13:50 -0500)
At least on my machine, the initial coding of this didn't actually
work, because interpolation of "$post_fh->filename" doesn't act
as intended.

I threw in some double quotes too, just in case anybody tries
to run this in a path containing spaces.

src/tools/pgindent/pgindent

index 73caa831d0afb9b2248cbc404617d7edc8a8882a..5eff1f8032dac434138c7230277f7b240d96f33e 100755 (executable)
@@ -299,12 +299,13 @@ sub show_diff
    my $source_filename = shift;
 
    my $post_fh = new File::Temp(TEMPLATE => "pgdiffXXXXX");
+   my $post_fh_filename = $post_fh->filename;
 
    print $post_fh $indented;
 
    $post_fh->close();
 
-   my $diff = `diff -upd $source_filename $post_fh->filename  2>&1`;
+   my $diff = `diff -upd "$source_filename" "$post_fh_filename"  2>&1`;
    return $diff;
 }