Skip to content

Commit

Permalink
fix: pushd is not posix compliant (automotiveMastermind#51)
Browse files Browse the repository at this point in the history
* resolve an issue where prompt could fail to install on operating systems where the default shell is not a bash-variant where `pushd` is available
* enable prompt to be installed in WSL 2 (tested in ubuntu) through bootstrap

![image](https://user-images.githubusercontent.com/1803684/82433773-d7351a00-9a89-11ea-98d4-a6a136a2d19d.png)
  • Loading branch information
dmccaffery committed May 21, 2020
1 parent 22827bb commit 6708af5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ __am_prompt_update()
local PROMPT_INTALL_TEMP=$(mktemp -d)
local PROMPT_EXTRACT_TEMP="$PROMPT_INTALL_TEMP/extract"

pushd $PROMPT_INTALL_TEMP 1>/dev/null
local CURRENT_DIR=${PWD}

cd $PROMPT_INTALL_TEMP 1>/dev/null
curl -skL $PROMPT_INSTALL_URI | tar zx
pushd prompt-master 1>/dev/null
cd prompt-master 1>/dev/null
./install.sh $PROMPT_SHELL
popd 1>/dev/null
popd 1>/dev/null
cd $CURRENT_DIR

rm -rf $PROMPT_INTALL_TEMP 1>/dev/null
}
Expand Down
9 changes: 5 additions & 4 deletions src/sh/scripts/update-prompt
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ __am_prompt_update()
local PROMPT_INTALL_TEMP=$(mktemp -d)
local PROMPT_EXTRACT_TEMP="$PROMPT_INTALL_TEMP/extract"

pushd $PROMPT_INTALL_TEMP 1>/dev/null
local CURRENT_DIR=${PWD}

cd $PROMPT_INTALL_TEMP 1>/dev/null
curl -skL $PROMPT_INSTALL_URI | tar zx
pushd prompt-master 1>/dev/null
cd prompt-master 1>/dev/null
./install.sh $PROMPT_SHELL
popd 1>/dev/null
popd 1>/dev/null
cd $CURRENT_DIR

rm -rf $PROMPT_INTALL_TEMP 1>/dev/null
}
Expand Down
6 changes: 3 additions & 3 deletions src/sh/scripts/update-sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ __contains() { for item in "${@:2}"; do [[ "$item" == "$1" ]] && return 0; done;

SOLUTIONS=($@)

CURRENT_PATH=$(pwd)
CURRENT_DIR=${PWD}

if [ ${#SOLUTIONS[@]} -eq 0 ]; then
SOLUTIONS=(*.sln)
Expand All @@ -25,7 +25,7 @@ for solution in "${SOLUTIONS[@]}"; do

echo "Checking solution: $name"

pushd "$basepath" 1>/dev/null
cd "$basepath" 1>/dev/null

EXISTING=($(dotnet sln "$name" list))
EXISTING=("${EXISTING[@]:2}")
Expand All @@ -39,5 +39,5 @@ for solution in "${SOLUTIONS[@]}"; do
__contains $discovered "${EXISTING[@]}" || dotnet sln "$name" add "$discovered"
done

popd 1>/dev/null
cd $CURRENT_DIR
done

0 comments on commit 6708af5

Please sign in to comment.