From 7e6e71c4f028a6fc1ad0016a46b0186ec30a3cfe Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Wed, 30 Apr 2025 07:14:07 -0700 Subject: [PATCH] Fix runfiles creation on windows --- perl/private/entrypoint.pl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/perl/private/entrypoint.pl b/perl/private/entrypoint.pl index c0e8f2a..3a89bd7 100644 --- a/perl/private/entrypoint.pl +++ b/perl/private/entrypoint.pl @@ -9,7 +9,7 @@ use JSON::PP; # Ensure enough args -die "Usage: $0 -- [args...]" unless @ARGV >= 3; +die "Usage: $0 -- [args...]\n" unless @ARGV >= 3; # Extract config path and main script path my $config_path = shift @ARGV; @@ -18,14 +18,14 @@ # Find `--` separator my $separator_index = 0; $separator_index++ until $separator_index >= @ARGV || $ARGV[$separator_index] eq '--'; -die "Missing -- separator after config and main script paths" if $separator_index == @ARGV; +die "Missing -- separator after config and main script paths\n" if $separator_index == @ARGV; # Get args after -- my @extra_args = @ARGV[ $separator_index + 1 .. $#ARGV ]; splice(@ARGV, $separator_index); # remove args after -- # Load JSON config -open my $fh, '<', $config_path or die "Can't open config file '$config_path': $!"; +open my $fh, '<', $config_path or die "Can't open config file '$config_path': $!\n"; my $json_text = do { local $/; <$fh> }; close $fh; @@ -46,18 +46,22 @@ $ENV{RUNFILES_DIR} = $runfiles; # Copy entries from manifest - open my $mfh, '<', $manifest or die "Failed to open manifest file '$manifest': $!"; + open my $mfh, '<', $manifest or die "Failed to open manifest file '$manifest': $!\n"; while (my $line = <$mfh>) { chomp $line; - next if $line =~ /^\s*$/; # skip blank lines + + # skip blank lines + next if $line =~ /^\s*$/; my ($rel_path, $real_path) = split ' ', $line, 2; - die "Invalid manifest line: $line" unless defined $real_path; + + # Skip any lines which don't cleanly split into key value pairs. + next unless defined $real_path && length $real_path; my $dst_path = File::Spec->catfile($runfiles, $rel_path); make_path(dirname($dst_path)); copy($real_path, $dst_path) - or die "Failed to copy '$real_path' to '$dst_path': $!"; + or die "Failed to copy '$real_path' to '$dst_path': $!\n"; } close $mfh; }