Interrumpir ejecucion de Plox con Ctrl-C filtra informacion del host.
- Dominant language
- Python
- Stars
- 9
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
## Codigo
```
// examples/while.lox
while (true) {
print "hello";
}
```
## Comportamiento actual
Si ejecuto:
```bash
plox examples/while.lox
```
Y luego hago `Ctrl-C`, me devuelvo.
```
hello
hello
hello
^CTraceback (most recent call last):
File "/home/pablo/.local/bin/plox", line 10, in
sys.exit(main())
^^^^^^
File "/home/pablo/code/plox/plox/__main__.py", line 177, in main
plox.main()
File "/home/pablo/code/plox/plox/__main__.py", line 155, in main
self.run(source)
File "/home/pablo/code/plox/plox/__main__.py", line 89, in run
lastvalue_produced = self.interpreter.interpret(statements)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pablo/code/plox/plox/Interpreter.py", line 79, in interpret
lastvalue_produced = self.execute(statement)
^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/bvqz3cy0fhcsb2nnnarv8szh36v9di2n-python3-3.12.13-env/lib/python3.12/functools.py", line 949, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pablo/code/plox/plox/Interpreter.py", line 146, in _
self.execute(statement.body)
File "/nix/store/bvqz3cy0fhcsb2nnnarv8szh36v9di2n-python3-3.12.13-env/lib/python3.12/functools.py", line 949, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pablo/code/plox/plox/Interpreter.py", line 150, in _
return self.execute_block(statement.statements, Env(enclosing=self.env))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pablo/code/plox/plox/Interpreter.py", line 188, in execute_block
self.execute(s)
File "/nix/store/bvqz3cy0fhcsb2nnnarv8szh36v9di2n-python3-3.12.13-env/lib/python3.12/functools.py", line 949, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pablo/code/plox/plox/Interpreter.py", line 103, in _
value = self.evaluate(statement.expression)
^^^^^^^^^^^^^
File "/nix/store/bvqz3cy0fhcsb2nnnarv8szh36v9di2n-python3-3.12.13-env/lib/python3.12/functools.py", line 953, in __get__
update_wrapper(_method, self.func)
File "/nix/store/bvqz3cy0fhcsb2nnnarv8szh36v9di2n-python3-3.12.13-env/lib/python3.12/functools.py", line 56, in update_wrapper
setattr(wrapper, attr, value)
KeyboardInterrupt
```
## Comportamiento esperado
Que falle gracefully o que tire un error de Lox, sin mostrar mensajes de Python.
## Creditos
Descubierto por @AndreaFigueroaR y @Pablo1107
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in plox/__main__.py, especially main() and run(), then trace the interpreter call shown in plox/Interpreter.py. Run `plox examples/while.lox` and interrupt it with Ctrl-C; done means the interruption exits gracefully or reports a Lox-level error without exposing a Python traceback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100