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

pip search should set and return a userful shell status code #22

Closed
vbabiy opened this issue Mar 15, 2011 · 8 comments
Closed

pip search should set and return a userful shell status code #22

vbabiy opened this issue Mar 15, 2011 · 8 comments
Assignees
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior

Comments

@vbabiy
Copy link
Contributor

vbabiy commented Mar 15, 2011

Currently, pip search exits with the status code 0 under all non-error conditions (as does most of pip itself I'd guess). But this is not very useful for e.g. testing if pip found a result.

It would be nice if pip search returned non-zero in case it does not find anything, so it can be used in sh scripts or lines.


@vbabiy
Copy link
Contributor Author

vbabiy commented Mar 15, 2011

I like the idea. One downside is that pip has to maintain a list of error
codes.

Example:

0  = 1 or more matches found

1  = Error, could not complete search request

23 = No matches found

+1


Original Comment By: Kelsey Hightower

@vbabiy
Copy link
Contributor Author

vbabiy commented Mar 15, 2011

  • Changed status from new to open.

Original Comment By: Carl Meyer

@KushalP
Copy link

KushalP commented Apr 21, 2011

There's actually a list of errno symbols here: http://docs.python.org/library/errno.html

Does a standard exit code system currently exist for pip?

@KushalP
Copy link

KushalP commented Apr 21, 2011

This is from the discussion in #pip on freenode:

  • Have SearchCommand raise a specific exception type, like SearchCommandError. This can be passed up to CommandError
  • The actual status code tests should occur on CommandError

@hltbra
Copy link
Contributor

hltbra commented Aug 2, 2011

By now we have zero (no exit status code specified at commands.search.run) for success and not found. I agree no matches should not exit 0, but I don't know what status code we should use.

Let me write a small patch.

@pnasrat
Copy link
Contributor

pnasrat commented Aug 2, 2011

@hugobr I thought I saw a pull request to add CommandError, etc.

@pnasrat
Copy link
Contributor

pnasrat commented Aug 2, 2011

Ah ok was merged

6f77168

@ghost ghost assigned hltbra Aug 2, 2011
hltbra added a commit that referenced this issue Dec 29, 2011
@hltbra
Copy link
Contributor

hltbra commented Dec 29, 2011

Sorry for taking so long to implement this and merge. It is done as follows:

SUCCESS = 0
ERROR = 1
UNKNOWN_ERROR = 2
VIRTUALENV_NOT_FOUND = 3
NO_MATCHES_FOUND = 23

There are places where exit status are hard coded and not imported from pip/status_codes.py.

@hltbra hltbra closed this as completed Dec 29, 2011
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants