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

Exitcodes parsing bug #35

Open
zupo opened this issue Dec 29, 2022 · 2 comments
Open

Exitcodes parsing bug #35

zupo opened this issue Dec 29, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@zupo
Copy link
Contributor

zupo commented Dec 29, 2022

The following snippet will crash tesh with the shown error:

```bash tesh-session="hello" tesh-ps1=">>>"
$ python
Python 3.10...
...

>>> exit()
```
Traceback (most recent call last):
  File "/nix/store/mvlayd2cp4lpgwfsmbdhva7ssa3h9vwn-python3.10-poetry2nix-env-scripts/bin/.tesh-wrapped", line 13, in <module>
    sys.exit(tesh())
  File "/nix/store/pwzxy20l2sqc9lh7abrdik6vbxpyrn6v-python3-3.10.4-env/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/pwzxy20l2sqc9lh7abrdik6vbxpyrn6v-python3-3.10.4-env/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/nix/store/pwzxy20l2sqc9lh7abrdik6vbxpyrn6v-python3-3.10.4-env/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/pwzxy20l2sqc9lh7abrdik6vbxpyrn6v-python3-3.10.4-env/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/zupo/work/tesh/src/tesh/__init__.py", line 59, in tesh
    test(filename, session, verbose, debug)
  File "/Users/zupo/work/tesh/src/tesh/test.py", line 94, in test
    exitcode = int(shell.before.decode("utf-8").strip())
ValueError: invalid literal for int() with base 10: 'File "<stdin>", line 1\r\n    echo $?\r\n         ^\r\nSyntaxError: invalid syntax'
@zupo
Copy link
Contributor Author

zupo commented Dec 29, 2022

The value of shell.before when it fails is:

'\r\n  File "<stdin>", line 1\r\n    echo $?\r\n         ^\r\nSyntaxError: invalid syntax\r\n'

@domenkozar domenkozar added the bug Something isn't working label Jul 18, 2023
@domenkozar
Copy link
Collaborator

It looks like Python doesn't exit here and tesh tries to get the exit codes by sending commands to python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants