From f92df25a2bfed91ffb7d59830e7ad8104d9ece10 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Tue, 22 Apr 2025 05:16:59 +0530 Subject: [PATCH] Added run files for openai call --- script/openai-call/run.bat | 23 +++++++++++++++++++++++ script/openai-call/run.sh | 17 +++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 script/openai-call/run.bat create mode 100644 script/openai-call/run.sh diff --git a/script/openai-call/run.bat b/script/openai-call/run.bat new file mode 100644 index 000000000..12c8a6224 --- /dev/null +++ b/script/openai-call/run.bat @@ -0,0 +1,23 @@ +@echo off +setlocal enabledelayedexpansion + +:: Function to exit if the last command failed +:exit_if_error +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% +exit /b 0 + +:: Function to run a command +:run +echo Running: +echo %1 +echo. + +if /I "%MLC_FAKE_RUN%" NEQ "yes" ( + call %1 + call :exit_if_error +) +exit /b 0 + +:: Add your run commands here... +call :run "%MLC_RUN_CMD%" + diff --git a/script/openai-call/run.sh b/script/openai-call/run.sh new file mode 100644 index 000000000..c4542b8c2 --- /dev/null +++ b/script/openai-call/run.sh @@ -0,0 +1,17 @@ +#!/bin/bash +function exit_if_error() { + test $? -eq 0 || exit $? +} + +function run() { + echo "Running: " + echo "$1" + echo "" + if [[ ${MLC_FAKE_RUN} != 'yes' ]]; then + eval "$1" + exit_if_error + fi +} + +#Add your run commands here... +run "$MLC_RUN_CMD"