Print commands as they execute #85

Closed
wants to merge 2 commits into
from

Projects

None yet

6 participants

Owner
croaky commented Apr 9, 2013

No description provided.

Owner
jferris commented Apr 10, 2013

Do we need to set +x at some point?

Owner
croaky commented Apr 10, 2013

@jferris Good point. Just made a few adjustments, including some echos to explain what's happening.

Ready for another review.

@gabebw gabebw commented on the diff Apr 10, 2013
@@ -7,6 +7,9 @@ successfully() {
echo "Fixing OSX zsh environment bug ..."
successfully sudo mv /etc/{zshenv,zshrc}
+echo "Setting shell to print commands as they execute ..."
+set -x
gabebw
gabebw Apr 10, 2013 Member

I just ran set -x and got a bunch of crazy output:

$ set -x
$ echo hello
+_zsh_highlight_preexec_hook:2> _ZSH_HIGHLIGHT_PRIOR_BUFFER='' 
+_zsh_highlight_preexec_hook:3> _ZSH_HIGHLIGHT_PRIOR_CURSOR='' 
+-zsh:348> echo hello
hello
+precmd:0> vcs_info prompt 
+....etc

Maybe set -v is better? Check it:

$ set -v
$ echo hello
echo hello
hello

You can turn it off with set +v.

mxie
mxie Apr 10, 2013 Member

I think the weird output has to do with some of the settings we already have in our .zshrc. I got a different kind of weird output:

$ set -x
+-zsh:2> parse_git_branch
+parse_git_branch:1> ref=+parse_git_branch:1> ref=''
+parse_git_branch:2> [[ -n '' ]]
+-zsh:2> parse_git_uncommitted
+parse_git_uncommitted:1> [[ -d .git ]]
+-zsh:2> parse_git_unstaged
+parse_git_unstaged:1> line=+parse_git_unstaged:1> line=+parse_git_unstaged:1> sed -n '2 p'
+parse_git_unstaged:1> line=''
+parse_git_unstaged:2> [[ -d .git ]]
joshuaclayton
joshuaclayton Apr 10, 2013 Owner

@mxie I saw similar results - it looks like it's kicking out commands run for the prompt - at least, that's where I started recognizing some of the output when I ran set -x. I'm not familiar enough with zsh to know what was going on here, though.

Owner
jferris commented Apr 10, 2013

I'm not sure what will happen if something fails in the middle there. I don't know when (if ever) that would reset.

You could add set +v to the sad path of successfully, which would at least catch those failures.

Owner
croaky commented Apr 10, 2013

I'm not sure what will happen if something fails in the middle there. I don't know when (if ever) that would reset.

Hmm, yeah. I don't feel particularly passionate about this change so I'm going to close without merging.

Thanks, all.

@croaky croaky closed this Apr 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment