feat: add sourcing of rc files to shell snapshot (#9150)
This commit is contained in:
parent
b9ff4ec830
commit
258fc4b401
1 changed files with 15 additions and 3 deletions
|
|
@ -135,7 +135,13 @@ async fn run_shell_script_with_timeout(
|
|||
}
|
||||
|
||||
fn zsh_snapshot_script() -> &'static str {
|
||||
r##"print '# Snapshot file'
|
||||
r##"if [[ -n "$ZDOTDIR" ]]; then
|
||||
rc="$ZDOTDIR/.zshrc"
|
||||
else
|
||||
rc="$HOME/.zshrc"
|
||||
fi
|
||||
[[ -r "$rc" ]] && . "$rc"
|
||||
print '# Snapshot file'
|
||||
print '# Unset all aliases to avoid conflicts with functions'
|
||||
print 'unalias -a 2>/dev/null || true'
|
||||
print '# Functions'
|
||||
|
|
@ -156,7 +162,10 @@ export -p
|
|||
}
|
||||
|
||||
fn bash_snapshot_script() -> &'static str {
|
||||
r##"echo '# Snapshot file'
|
||||
r##"if [ -z "$BASH_ENV" ] && [ -r "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
echo '# Snapshot file'
|
||||
echo '# Unset all aliases to avoid conflicts with functions'
|
||||
unalias -a 2>/dev/null || true
|
||||
echo '# Functions'
|
||||
|
|
@ -180,7 +189,10 @@ export -p
|
|||
}
|
||||
|
||||
fn sh_snapshot_script() -> &'static str {
|
||||
r##"echo '# Snapshot file'
|
||||
r##"if [ -n "$ENV" ] && [ -r "$ENV" ]; then
|
||||
. "$ENV"
|
||||
fi
|
||||
echo '# Snapshot file'
|
||||
echo '# Unset all aliases to avoid conflicts with functions'
|
||||
unalias -a 2>/dev/null || true
|
||||
echo '# Functions'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue