Skip to content

Commit 7090d3e

Browse files
committed
Fix other problem with OS X and base64
1 parent db704f0 commit 7090d3e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

zsh/faraday.zsh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ USERPS1=$PS1
1111
PS1="%{${fg_bold[red]}%}[faraday]($WORKSPACE)%{${reset_color}%} $USERPS1"
1212
export FARADAY_OUTPUT=
1313
export FARADAY_PLUGIN=
14+
alias faraday_b64='base64 -w 0'
15+
16+
if [[ $(uname) == 'Darwin' ]]; then
17+
alias faraday_b64='base64'
18+
fi
1419

1520
echo ">>> WELCOME TO FARADAY"
1621
echo "[+] Current Workspace: $WORKSPACE"
@@ -33,8 +38,8 @@ function add-output() {
3338
old_cmd=$BUFFER
3439
FARADAY_PLUGIN=
3540
FARADAY_OUTPUT=
36-
pwd_actual=$(printf "%s" "$(pwd)"| base64 -w 0)
37-
cmd_encoded=$(printf "%s" "$BUFFER"| base64 -w 0)
41+
pwd_actual=$(printf "%s" "$(pwd)"| faraday_b64)
42+
cmd_encoded=$(printf "%s" "$BUFFER"| faraday_b64)
3843
json_response=`curl -s -X POST -H "Content-Type: application/json" -d "{\"cmd\": \"$cmd_encoded\", \"pid\": $$, \"pwd\": \"$pwd_actual\"}" http://$FARADAY_ZSH_HOST:$FARADAY_ZSH_RPORT/cmd/input`
3944
if [[ $? -eq 0 ]]; then
4045
code=`echo $json_response|env python2.7 -c "import sys, json;print(json.load(sys.stdin)[\"code\"])"`

0 commit comments

Comments
 (0)