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

Comments

Projects
None yet
4 participants
@vbabiy
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

This comment has been minimized.

Show comment
Hide comment
@vbabiy

vbabiy Mar 15, 2011

Contributor

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
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@vbabiy

vbabiy Mar 15, 2011

Contributor
  • Changed status from new to open.

Original Comment By: Carl Meyer
Contributor

vbabiy commented Mar 15, 2011

  • Changed status from new to open.

Original Comment By: Carl Meyer
@KushalP

This comment has been minimized.

Show comment
Hide comment
@KushalP

KushalP 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 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

This comment has been minimized.

Show comment
Hide comment
@KushalP

KushalP 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

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

This comment has been minimized.

Show comment
Hide comment
@hltbra

hltbra Aug 2, 2011

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@pnasrat

pnasrat Aug 2, 2011

Contributor

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

Contributor

pnasrat commented Aug 2, 2011

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

@pnasrat

This comment has been minimized.

Show comment
Hide comment
@pnasrat

pnasrat Aug 2, 2011

Contributor

Ah ok was merged

6f77168

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

This comment has been minimized.

Show comment
Hide comment
@hltbra

hltbra Dec 29, 2011

Member

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.

Member

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 Dec 29, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment