Skip to content

Commit 868b611

Browse files
authored
Very short description of exit codes and how to access them (#3112)
2 parents 8d4051e + b44b682 commit 868b611

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

docs/command-line-reference.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# General Command Line Topics
2+
3+
```{currentmodule} click
4+
```
5+
6+
```{contents}
7+
---
8+
depth: 1
9+
local: true
10+
---
11+
```
12+
13+
## Exit Codes
14+
15+
When a command is executed from the command line, then an exit code is return. The exit code, also called exit status or exit status code, is a positive integer that tells you whether the command executed with or without errors.
16+
17+
| Exit Code | Meaning |
18+
|-----------|-------------------------------------------------|
19+
| 0 | Success — the command completed without errors. |
20+
| > 0 | Executed with errors |
21+
22+
Exit codes greater than zero mean are specific to the Operating System, Shell, and/or command.
23+
24+
To access the exit code, execute the command, then do the following depending:
25+
26+
```{eval-rst}
27+
.. tabs::
28+
29+
.. group-tab:: Powershell
30+
31+
.. code-block:: powershell
32+
33+
> echo $LASTEXITCODE
34+
35+
.. group-tab:: Bash
36+
37+
.. code-block:: bash
38+
39+
$ echo $?
40+
41+
.. group-tab:: Command Prompt
42+
43+
44+
.. code-block:: text
45+
46+
> echo %ERRORLEVEL%
47+
48+
```

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ General Reference
112112
utils
113113
shell-completion
114114
exceptions
115+
command-line-reference
115116
unicode-support
116117
wincmd
117118

0 commit comments

Comments
 (0)