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

prompt gitstatus: Bad file descriptor #5323

Open
arkhan opened this issue Apr 5, 2024 · 3 comments
Open

prompt gitstatus: Bad file descriptor #5323

arkhan opened this issue Apr 5, 2024 · 3 comments

Comments

@arkhan
Copy link

arkhan commented Apr 5, 2024

When running git push it usually gives this error, it is random

xonfig

+------------------+-----------------------------------+
| xonsh            | 0.15.1                            |
| Python           | 3.10.7                            |
| PLY              | 3.11                              |
| have readline    | True                              |
| prompt toolkit   | 3.0.43                            |
| shell type       | prompt_toolkit                    |
| history backend  | sqlite                            |
| pygments         | 2.12.0                            |
| on posix         | True                              |
| on linux         | True                              |
| distro           | guix                              |
| on wsl           | False                             |
| on darwin        | False                             |
| on windows       | False                             |
| on cygwin        | False                             |
| on msys2         | False                             |
| is superuser     | False                             |
| default encoding | utf-8                             |
| xonsh encoding   | utf-8                             |
| encoding errors  | ignore                            |
| xontrib 1        | coreutils                         |
| xontrib 2        | fzf-widgets                       |
| xontrib 3        | z                                 |
| xontrib 4        | langenv_common                    |
| xontrib 5        | direnv                            |
| xontrib 6        | sh                                |
| xontrib 7        | argcomplete                       |
| xontrib 8        | readable-traceback                |
| xontrib 9        | pyenv                             |
| RC file 1        | /home/arkhan/.config/xonsh/rc.xsh |
+------------------+-----------------------------------+

Traceback (if applicable)

 » git push                                                       ~/d/d/o/v/git_repo main↑·1|✓
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 404 bytes | 404.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:arkhan/git_repo
   45f26c4..d81375b  main -> main
 » prompt: error: on field 'gitstatus'                ~/d/d/o/v/op_pecksambiente <Prompt: gitstatus>
Traceback (Most recent call last):
133 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh
/prompt/base.py _get_field_value --> return self.fields.pick(field)
381 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/base.py pick --> value.update(self)
343 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/gitstatus.
py update --> super().update(ctx)
519 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/base.py update --> self.value = self.separator.join(self._collect(ctx))
514 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/base.py _collect --> yield format(ctx.pick(frag))
381 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/base.py pick --> value.update(self)
126 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/gitstatus.py update --> self.updator(self, ctx)
246 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/gitstatus.py get_gitstatus_info --> info = ctx.pick_val(porcelain)
391 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/base.py pick_val --> val = self.pick(key)
381 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/base.py pick --> value.update(self)
126 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/gitstatus.py update --> self.updator(self, ctx)
196 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/gitstatus.py porcelain --> status = _get_sp_output(ctx.xsh, "git", "status", "--porcelain", "--branch")
75 /gnu/store/628l0w956z89mx7v1dj9vz8k450cnak8-xonsh-next-0.15.1/lib/python3.10/site-packages/xonsh/prompt/gitstatus.py _get_sp_output --> with subprocess.Popen(args, **kwargs) as proc:
1037 /gnu/store/3lxr2xg3yscdb3979blgjg0h7xd1n9la-python-3.10.7/lib/python3.10/subprocess.py __exit__ --> self.stdout.close()
OSError: [Errno 9] Bad file descriptor
    Exception ignored when trying to write to the signal wakeup fd:ecksambiente {ERROR:gitstatus   }
Traceback (most recent call last):
  File "/gnu/store/3lxr2xg3yscdb3979blgjg0h7xd1n9la-python-3.10.7/lib/python3.10/asyncio/unix_events.py", line 42, in _sighandler_noop
    def _sighandler_noop(signum, frame):
BrokenPipeError: [Errno 32] Broken pipe

Steps to Reproduce

it's random when running git push

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@anki-code
Copy link
Member

anki-code commented Apr 5, 2024

hi! Nice catch. Your prompt is looking like starship or something like this. Is it right or you construct prompt manually using $PROMPT? Please share details of how it works.

@arkhan
Copy link
Author

arkhan commented Apr 5, 2024

I do it manually, here is my configuration rc.xsh:

env["PROMPT"] = "{BOLD_WHITE}{env_name_simple}{RESET}{BOLD_BLUE} »{RESET} "
env["RIGHT_PROMPT"] = "{BOLD_INTENSE_BLACK}{short_cwd}{RESET} {gitstatus}"

@anki-code
Copy link
Member

Maybe for some reason git status is trying to read files that were changed during git push. We need to mitigate this. PR is welcome!

@anki-code anki-code changed the title prompt: error: on field 'gitstatus' prompt gitstatus: Bad file descriptor Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants