mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-08-23 00:59:06 +08:00

Seems that folk are having issues with uploading 0-byte files from Windows agents. This effectively removes the support for Windows for uploading from named files that, due to `isFIFO` returning `false` on Windows for named pipes created using MSYS2's `mkfifo` command, resorted to checking if the file size is 0 - a common trait of named pipes. See https://github.com/actions/upload-artifact/issues/281
27 lines
574 B
Bash
Executable File
27 lines
574 B
Bash
Executable File
#!/bin/bash
|
|
|
|
path="$1"
|
|
expectedContent="$2"
|
|
|
|
if [ "$path" == "" ]; then
|
|
echo "File path not provided"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$expectedContent" == "" ]; then
|
|
echo "Expected file contents not provided"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$path" ]; then
|
|
echo "Expected file $path does not exist"
|
|
exit 1
|
|
fi
|
|
|
|
actualContent=$(cat "$path")
|
|
if [ "$expectedContent" == "_EMPTY_" ] && [ ! -s "$path" ]; then
|
|
exit 0
|
|
elif [ "$actualContent" != "$expectedContent" ]; then
|
|
echo "File contents are not correct, expected $expectedContent, received $actualContent"
|
|
exit 1
|
|
fi |