diff --git a/include/os/osFile.h b/include/os/osFile.h index b364d233efdf6b467e8cd24e2685e4e50ffc5f8e..5ba161270df9daa539514b708b31a38cd271246f 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -80,6 +80,7 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count); void taosFprintfFile(TdFilePtr pFile, const char *format, ...); int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict ptrBuf); +int64_t taosGetsFile(TdFilePtr pFile, int32_t maxSize, char *__restrict buf); int32_t taosEOFFile(TdFilePtr pFile); diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index ab68c69b8db2a6be1b7467093a09c1174a8dac95..4fd672fe3c802e510c76f6aa019a26e67ea00544 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -688,6 +688,16 @@ int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) { return getline(ptrBuf, &len, pFile->fp); #endif } +int64_t taosGetsFile(TdFilePtr pFile, int32_t maxSize, char *__restrict buf) { + if (pFile == NULL || buf == NULL ) { + return -1; + } + assert(pFile->fp != NULL); + if (fgets(buf, maxSize, pFile->fp) == NULL) { + return -1; + } + return strlen(buf); +} int32_t taosEOFFile(TdFilePtr pFile) { if (pFile == NULL) { return 0; diff --git a/tests/script/sh/copy_udf.sh b/tests/script/sh/copy_udf.sh index e1d9ff53d27462fcb05fa6902301faa4f625d44a..97f8b163633d019f7bae6d0c0ea66ef9f1366eee 100755 --- a/tests/script/sh/copy_udf.sh +++ b/tests/script/sh/copy_udf.sh @@ -5,7 +5,7 @@ set +e echo "Executing copy_udf.sh" -SCRIPT_DIR=`dirname $0` +SCRIPT_DIR=`pwd` cd $SCRIPT_DIR/../ IN_TDINTERNAL="community" diff --git a/tests/script/tsim/tmq/consume.sh b/tests/script/tsim/tmq/consume.sh index 28e03d8fb977ca7cabc1e9038175a1619b4f0ec8..3fa71d6edd96b6c664d5c680fb2615c730e14f8e 100755 --- a/tests/script/tsim/tmq/consume.sh +++ b/tests/script/tsim/tmq/consume.sh @@ -62,11 +62,7 @@ fi TOP_DIR=`pwd` -if [[ "$SCRIPT_DIR" == *"$IN_TDINTERNAL"* ]]; then - BIN_DIR=`find . -name "tmq_sim"|grep bin|head -n1|cut -d '/' -f 2,3` -else - BIN_DIR=`find . -name "tmq_sim"|grep bin|head -n1|cut -d '/' -f 2` -fi +BIN_DIR=`find . -name "tmq_sim"|grep bin|head -n1|cut -d '/' -f 2` declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR