Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brackets showing up instead of normal prompt representation #13

Open
btabibian opened this issue Aug 26, 2015 · 14 comments
Open

brackets showing up instead of normal prompt representation #13

btabibian opened this issue Aug 26, 2015 · 14 comments

Comments

@btabibian
Copy link
Contributor

Hi,

When I add export PS1="\W\$(~/git-radar/git-radar --bash) " to my .bashrc I get the following:

py_ \[\]git:(\[\]\[\]master\[\]\[\])\[\] 3\[\]M\[\] 59\[\]A\[\]

Where py_ is my current direcotry.

When I add export PS1="\W$(~/git-radar/git-radar --bash) " it shows the correct format but no longer updates. I suppose this has to do with static executation and lazy evaluation of bash for PS1 and thus not the correct way of using your script.

I will appreciate if you could help.

P.s the package is fantastic. Cannot wait to use it and possibly contribute back.

@michaeldfallen
Copy link
Owner

Thanks for the feedback, glad you like it.

Have you got the latest pulled? There was a problem with zero width characters (flagged up in #4) which was fixed by @Eyeofhell in #7. Problem was this only works if you don't set your PS1 using " like you have here (and like I was).

#11 I think has fixed this by switching from \[ to \x01 (a conversion that PS1 handles for you, for some reason).

Try pulling the latest and see if that helps.

@michaeldfallen
Copy link
Owner

Sorry, the other problem you mention, where you use " and then it renders properly but doesn't update. That's because the $() renders when PS1 is exported, rather than every time it's rendered.

The fix is use either:

export PS1="\W\$(~/git-radar/git-radar --bash) "

(^ the '' escaping the $ is important)

or

export PS1='\W$(~/git-radar/git-radar --bash) '

With the latest pull both of those should work for you. I'll need to update the docs to reflect that missing \.

@btabibian
Copy link
Contributor Author

It worked! this is really great.

Now when I add --fetch command I get following:

nohup: redirecting stderr to stdout

Is there a solution for this as well?

@michaeldfallen
Copy link
Owner

Hmm, that's odd. I haven't seen that before. Probably I'm not doing the nohup correctly at https://github.com/michaeldfallen/git-radar/blob/master/git-radar#L80.

@michaeldfallen
Copy link
Owner

if you do a man nohup what do you get?

@btabibian
Copy link
Contributor Author

I get the follow:

NOHUP(1) User Commands NOHUP(1)

NAME
nohup - run a command immune to hangups, with output to a non-tty

SYNOPSIS
nohup COMMAND [ARG]...
nohup OPTION

DESCRIPTION
Run ...

@btabibian
Copy link
Contributor Author

I suppose it should be this:

nohup ~/git-radar/fetch.sh >/dev/null 2>&1

@btabibian
Copy link
Contributor Author

I can make a diff and send you the pull request if it makes sense?

@michaeldfallen
Copy link
Owner

Yeah I'd try a variety of:

nohup ~/git-radar/fetch.sh >/dev/null 2>&1 &
(nohup ~/git-radar/fetch.sh >/dev/null) &
(nohup ~/git-radar/fetch.sh >/dev/null &)

@michaeldfallen
Copy link
Owner

Yeah submit a PR if you think you've fixed it. Happy to merge.

@btabibian
Copy link
Contributor Author

I will do a test and let you know.

@btabibian
Copy link
Contributor Author

I think there was a problem from my side. Tried again and it worked without any changes.

@btabibian
Copy link
Contributor Author

Not so fast, apparently what is happening is that git crashes in one of its fetches so I get the following:

fatal: Unable to create 'PATH/.git/index.lock' 

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
Cannot save the current index state
nohup: redirecting stderr to stdout

and after that every call gives me:

nohup: redirecting stderr to stdout

@btabibian
Copy link
Contributor Author

This happens on my Ubuntu and I cannot reproduce it on Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants