mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-22 00:03:58 +01:00
Implement fix for #238 by sourcing .profile from .bash_profile to prevent breaking users that rely on .profile from bash
This commit is contained in:
parent
4a9af23f30
commit
f5d3899433
@ -398,6 +398,9 @@ func configureBashrc(homedir, binaryPath string, skipConfigModification bool) er
|
||||
}
|
||||
// Check if we need to configure the bash_profile and configure it if so
|
||||
if doesBashProfileNeedConfig(homedir) {
|
||||
_, err := os.Stat(path.Join(homedir, ".bash_profile"))
|
||||
bashProfileExists := !errors.Is(err, os.ErrNotExist)
|
||||
|
||||
bashProfileIsConfigured, err := isBashProfileConfigured(homedir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check ~/.bash_profile: %w", err)
|
||||
@ -407,6 +410,14 @@ func configureBashrc(homedir, binaryPath string, skipConfigModification bool) er
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !bashProfileExists {
|
||||
// If the .bash_profile doesn't exist and we just created it, we're breaking the sourcing of .profile (see #238)
|
||||
// So we need to source .profile from .bash_profile
|
||||
err = addToShellConfig(path.Join(homedir, ".bash_profile"), "\n# Source .profile:\nsource ~/.profile\n", skipConfigModification)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user