From f818ddb32652f52b7dc7ee65b4221ef01eade81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Tue, 15 Feb 2022 00:02:58 +0100 Subject: [PATCH] Notify user if SHELL environment variable is unset. If the SHELL environment variable is unset local::lib installation may fail. See issue #154. --- lib/CPAN/FirstTime.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm index 8934f4a2..f701d218 100644 --- a/lib/CPAN/FirstTime.pm +++ b/lib/CPAN/FirstTime.pm @@ -1057,6 +1057,9 @@ sub init { $path ||= 'sh', $path =~ s,\\,/,g if $^O eq 'os2'; # Cosmetic only my_dflt_prompt(shell => $path, $matcher); } + if (!$CPAN::Config->{shell}) { + $CPAN::Frontend->mywarn("No user shell found. Please set the SHELL environment variable\n"); + } } { @@ -1496,6 +1499,9 @@ HERE ); sub _find_shell_config { + if (!$CPAN::Config->{shell}) { + $CPAN::Frontend->mydie("No user shell found. Please set the SHELL environment variable"); + } my $shell = File::Basename::basename($CPAN::Config->{shell}); if ( my $rc = $shell_rc_map{$shell} ) { my $path = File::Spec->catfile($ENV{HOME}, $rc);