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

documentation has bad example code #717

Closed
oren-hecht opened this issue Jan 4, 2024 · 1 comment
Closed

documentation has bad example code #717

oren-hecht opened this issue Jan 4, 2024 · 1 comment

Comments

@oren-hecht
Copy link

oren-hecht commented Jan 4, 2024

In the "Exit Codes and Exceptions" section of the documentation -https://github.com/amoffat/sh/blob/develop/docs/source/sections/exit_codes.rst#exit-codes--exceptions

there is the first example code

output = ls("/")
print(output.exit_code) # should be 0

This code does not work as described - when run in the terminal it returns an exception. It seems the way to make it work as described is -

ls("/", _return_cmd=True)
print(output.exit_code) # should be 0

this seems to include a larger issue, where the object returns is a string instead of a RunningComand object.. a fix for this may also be planned, but for now maybe consider fixing the docs?

image

@ecederstrand
Copy link
Collaborator

Thanks for the report!

This was the only instance in the docs that needed fixing, AFAICS.

Commands return strings by default since sh 2.0.0, so only the docs needed fixing.

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