opendevin/core/main.py: Graceful shutdown (#1731)

* opendevin/core/main.py: Graceful shutdown

* Shutdown controller at exit

* Update opendevin/core/main.py

---------

Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com>
Co-authored-by: Graham Neubig <neubig@gmail.com>
This commit is contained in:
Boxuan Li
2024-05-12 13:56:35 -07:00
committed by GitHub
parent e5f1dbf5e7
commit 49de262577
2 changed files with 8 additions and 7 deletions

View File

@@ -17,8 +17,7 @@ workspace_base = os.getenv('WORKSPACE_BASE')
)
def test_write_simple_script():
task = "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point."
controller = asyncio.run(main(task))
asyncio.run(controller.close())
asyncio.run(main(task))
# Verify the script file exists
script_path = os.path.join(workspace_base, 'hello.sh')
@@ -58,8 +57,7 @@ def test_edits():
# Execute the task
task = 'Fix typos in bad.txt. Do not ask me for confirmation at any point.'
controller = asyncio.run(main(task))
asyncio.run(controller.close())
asyncio.run(main(task))
# Verify bad.txt has been fixed
text = """This is a stupid typo.