From 9b5ac360b7d464dd3755b011d82674c48c1bebed Mon Sep 17 00:00:00 2001 From: eine Date: Sat, 10 Oct 2020 18:11:37 +0200 Subject: [PATCH] skip empty files (#159) --- .github/workflows/test.yml | 3 ++- tip.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f2ccee5..0cf1602 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,10 +36,11 @@ jobs: artifact-*.txt README.md - - name: Add artifacts/artifact.txt + - name: Add artifacts/*.txt run: | mkdir artifacts echo "Build some tool and generate some artifacts" > artifacts/artifact.txt + touch artifacts/empty_file.txt - name: Single in subdir uses: ./ diff --git a/tip.py b/tip.py index 4f1324a..acd18ac 100755 --- a/tip.py +++ b/tip.py @@ -27,7 +27,11 @@ if len(args) == 0: for item in args: items = [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()] print("glob(%s)" % item, "->", items) - files = files + items + for fname in items: + if Path(fname).stat().st_size == 0: + print("! Skipping empty file %s" % fname) + continue + files += [fname] if len(files) < 1: stdout.flush()