Skip to content

Commit 7f5569f

Browse files
committed
fix(ci): close unused file descriptors before running valgrind
1 parent dd2f0e5 commit 7f5569f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,22 @@ jobs:
388388
- name: Valgrind checks for memory leaks
389389
shell: bash
390390
run: |
391-
valgrind --leak-check=full --show-leak-kinds=all \
392-
--track-origins=yes --track-fds=yes \
393-
--trace-children=yes \
391+
# hack to close fd 155 and 158 as github leaves them open
392+
# thread: https://github.com/actions/runner-images/issues/3729
393+
# solution from: https://github.com/actions/runner-images/issues/3391#issuecomment-842139475
394+
if [ -d /proc/$$/fd/ ]; then
395+
for descriptor_path in /proc/$$/fd/*; do
396+
descriptor="$(basename "$descriptor_path")"
397+
# Don't close stdin/stderr/stdout (-gt 2)
398+
if [ $descriptor -gt 2 ]; then
399+
exec {descriptor}<&-
400+
fi
401+
done
402+
fi
403+
valgrind --leak-check=full \
404+
--show-leak-kinds=all --show-reachable=yes \
405+
--track-origins=yes --track-fds=yes --trace-children=yes \
394406
--verbose -s \
407+
--demangle=yes \
395408
--error-exitcode=1 \
396409
build/arkscript tests/unittests/resources/LangSuite/unittests.ark -L ./lib valgrind

0 commit comments

Comments
 (0)