Azure DevOps Server: How to prevent 'Access to path is denied' when initalizing a job?
If your assumption is correct:
What I understand from this is that because
chromedriver.exe
is still running ADOS cannot delete its.exe
file when it tries to clean the working folder at the start of the build run.
Make sure you are using the driver.close()
as well as the driver.quit()
methods at the end of every test.
Use teardown to make sure it will always happen.
EDIT:
As OP commented:
when I cancel the ADOS build, the test step is terminated abruptly and the teardown step is not executed.
My recommendation is to an atexit
method.
For C# Use ProcessExit Event (credit to @Fredrik Mörk's answer)
For Python use atexit
I've come up with a solution based on ADOS Pipelines' functionality. After my Visual Studio Test task I've added a Command Line task and configured it like so:
- The script is '
taskkill
/IM chromedriver.exe /F
'. - Under Control Options I've set:
- Run this task to 'Custom conditions'
- Custom condition to '
canceled()
' - Continue on error checked.
This way, whenever my build is cancelled manually, all instances of the chromedriver.exe
process are terminated, clearing the way for subsequent builds to run.