--- a/codesys-ide/codesys +++ b/codesys-ide/codesys @@ -59,9 +59,19 @@ sleep 1 export WINEPREFIX=~/.wine.cds ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/noop.py" --noUI 2> /dev/zero - ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI 2> /dev/zero + # remove output log + [ -f .codesys.output.txt ] && rm -f .codesys.output.txt + # check if script runs with or without UI + if grep '# CODESYS with UI' "${BASEPATH}/${1}.py" 2>&1 > /dev/zero; then + ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" 2> /dev/zero + else + ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI 2> /dev/zero + fi result=$? - sleep 1 + + # flush output log + [ -f .codesys.output.txt ] && cat .codesys.output.txt + sleep 1 killall Xvfb rm -rf /tmp/.X91*