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

running shpc show with pipe command leads to exception #645

Closed
shahzebsiddiqui opened this issue May 2, 2023 · 2 comments · Fixed by #647
Closed

running shpc show with pipe command leads to exception #645

shahzebsiddiqui opened this issue May 2, 2023 · 2 comments · Fixed by #647

Comments

@shahzebsiddiqui
Copy link

shahzebsiddiqui commented May 2, 2023

Describe the bug

I was trying to run shpc show and filter by first x lines using head or tail and this led to exception

(singularity-hpc)  ~/gitrepos/singularity-hpc/ [main*] shpc show | head -n 5
adminer
bids/aa
bids/baracus
bids/brainiak-srm
bids/brainsautoworkup
Traceback (most recent call last):
  File "/global/u1/s/siddiq90/.local/share/virtualenvs/singularity-hpc-9qpnFEzH/bin/shpc", line 33, in <module>
    sys.exit(load_entry_point('singularity-hpc', 'console_scripts', 'shpc')())
  File "/global/u1/s/siddiq90/gitrepos/singularity-hpc/shpc/client/__init__.py", line 549, in run_shpc
    main(args=args, parser=parser, extra=extra, subparser=helper)
  File "/global/u1/s/siddiq90/gitrepos/singularity-hpc/shpc/client/show.py", line 22, in main
    cli.show(args.name, names_only=not args.versions, filter_string=args.filter_string)
  File "/global/u1/s/siddiq90/gitrepos/singularity-hpc/shpc/main/client.py", line 246, in show
    out.write("%s\n" % config.name)
BrokenPipeError: [Errno 32] Broken pipe

I can confirm this was an issue when piping with tail and more

To Reproduce
Run shpc show | head -n 5

Expected behavior
i should see the output without an exception. It looks like the file in client.py doing out.write

Version of Singularity and Singularity Registry HPC Client

(singularity-hpc)  ~/gitrepos/singularity-hpc/ [main*] shpc --version
0.1.21

Anything else?

@vsoch
Copy link
Member

vsoch commented May 2, 2023

Please see #647

@shahzebsiddiqui
Copy link
Author

Thanks I did take a look at the PR.

@vsoch vsoch closed this as completed in #647 May 4, 2023
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

Successfully merging a pull request may close this issue.

2 participants