acc: Add example on how to do trap (#2475)

Discovered that 'trap' does not work with $CLI on Windows when working
#2471

This example shows a workaround.
This commit is contained in:
Denis Bilenko 2025-03-12 10:40:15 +01:00 committed by GitHub
parent 992425e8ab
commit 85b4c9b4dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,6 @@
run first
>>> [CLI] missing-command
Error: unknown command "missing-command" for "databricks"
Exit code: 1

View File

@ -0,0 +1,7 @@
# This does not work on Windows, somehow all the slashes are lost:
# command: trap "$CLI missing-command" EXIT
# output: script: line 1: Y:cliacceptancebuildwindows_amd64databricks.exe: command not found
# Adding single quotes around $CLI helps:
trap "errcode trace '$CLI' missing-command" EXIT
echo "run first"