kangwonlee / kangwonlee/tutorial

Detect shell command error

Offen
#14 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Jupyter Notebook
Sterne
1
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

* `git checkout ` does not raise an exception
* `out = !git checkout ` would capture the output error message but seems not exactly desirable as a tutorial
* `%%script bash --out stdout --err stderr` captures `stdout` and `stderr` respectively

## References

* https://stackoverflow.com/questions/35857230/ipython-raise-exception-when-a-shell-command-fails
* https://jakevdp.github.io/PythonDataScienceHandbook/01.05-ipython-and-shell-commands.html
* https://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-script

## Observation

* Following cell would raise an error

``` sh
%%bash --out stdout --err stdout
git checkout
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

No source file or notebook path is named. Start with the `%%bash --out stdout --err stdout` example and read the linked IPython cell-magic documentation and references to determine how nonzero shell exit status should be handled. Done means the tutorial clearly demonstrates the intended error behavior for the invalid `git checkout` command.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
bash, git, jupyter-notebook
Bereich
cli, documentation
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.