eXceediDeaL / edl-coderunner

A CLI tool to run code.
Apache License 2.0
1 stars 0 forks source link

Crashed with AttributeError when kill running subprocess #3

Closed StardustDL closed 5 years ago

StardustDL commented 5 years ago

Environment

Description

When use run -io ss and do not input anything, just kill the subprocess, it raised AttributeError. But I expect it gives a Running failed.

Output

Traceback (most recent call last):
  File "C:\Python37\Scripts\ecr-script.py", line 11, in <module>
    load_entry_point('edl-cr==0.0.2.7', 'console_scripts', 'ecr')()
  File "C:\Python37\lib\site-packages\edl_cr-0.0.2.7-py3.7.egg\ecr\__main__.py", line 248, in outmain
    exit(int(main()))
  File "C:\Python37\lib\site-packages\edl_cr-0.0.2.7-py3.7.egg\ecr\__main__.py", line 241, in main
    if executeCommand(oricmd) == ReturnCode.EXIT.value:
  File "C:\Python37\lib\site-packages\edl_cr-0.0.2.7-py3.7.egg\ecr\__main__.py", line 186, in executeCommand
    return cmd.func(cmd).value
  File "C:\Python37\lib\site-packages\edl_cr-0.0.2.7-py3.7.egg\ecr\command.py", line 184, in run
    result = tman.execute(io=args.io, item=item)
  File "C:\Python37\lib\site-packages\edl_cr-0.0.2.7-py3.7.egg\ecr\core\manager.py", line 326, in execute
    return self.__runCommands(io, cmds, formats)
  File "C:\Python37\lib\site-packages\edl_cr-0.0.2.7-py3.7.egg\ecr\core\manager.py", line 293, in __runCommands
    f"{round(cast(Runner,self.runner).usedTime*1000)/1000}s")
AttributeError: 'NoneType' object has no attribute 'usedTime'
eXceediDeaL commented 5 years ago

Fixed. The 231 line makes this bug: https://github.com/eXceediDeaL/edl-coderunner/blob/1ee33877fc0222e18e1463172440b1e04da5c2e1/src/ecr/core/manager.py#L225-L235