rliszli commented on code in PR #8015: URL: https://github.com/apache/nifi/pull/8015#discussion_r1419023938
########## minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/src/main/resources/bin/delete-service.bat: ########## @@ -16,8 +16,16 @@ rem See the License for the specific language governing permissions and rem limitations under the License. rem -set SERVICE_NAME=minifi -set SRV_BIN=%SERVICE_NAME%.exe - -REM Remove service -%SRV_BIN% //DS//%SERVICE_NAME% +setlocal enabledelayedexpansion + +set arg1=%1 +if "!arg1:~1,11!" equ "serviceName" ( Review Comment: Unfortunatelly I tried a lot of ways to do this. For example, the suggested _findstr_ cannot be applied inside an if condition. Honestly I don't like this either, as most part of how bat script working, but this was the "cleanest" or "simpliest" as I could find. ########## minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/src/main/resources/bin/install-service.bat: ########## @@ -16,13 +16,77 @@ rem See the License for the specific language governing permissions and rem limitations under the License. rem -call minifi-env.bat +call %~sdp0\minifi-env.bat -set CONF_DIR=%MINIFI_ROOT%conf +setlocal enabledelayedexpansion +set "arg1=" +set "arg2=" +set "arg3=" +set "errorFlag=0" + +set "argCount=0" +for %%A in (%*) do ( Review Comment: Thanks, good idea, applied. Made the "code" much cleaner. ########## minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/src/main/resources/bin/install-service.bat: ########## @@ -16,13 +16,77 @@ rem See the License for the specific language governing permissions and rem limitations under the License. rem -call minifi-env.bat +call %~sdp0\minifi-env.bat -set CONF_DIR=%MINIFI_ROOT%conf +setlocal enabledelayedexpansion +set "arg1=" +set "arg2=" +set "arg3=" +set "errorFlag=0" + +set "argCount=0" +for %%A in (%*) do ( + set /a "argCount+=1" + + if !argCount! equ 1 set "arg1=%%~A" + if !argCount! equ 2 set "arg2=%%~A" + if !argCount! equ 3 set "arg3=%%~A" + + if !argCount! geq 4 ( + set "errorFlag=tooManyArguments" + goto :error + ) + + if "!arg1:~0,11!" equ "serviceName" ( Review Comment: Thanks, should be fine now. ########## minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-resources/src/main/resources/bin/install-service.bat: ########## @@ -65,12 +125,21 @@ set LOG_PREFIX=minifi.log --StopMethod="%STOP_METHOD%" ^ --StopTimeout="%STOP_TIMEOUT%" ^ --Classpath="%CLASS_PATH%" ^ ---JvmOptions="%JAVA_ARGS%" ^ +--JvmOptions9="%JAVA_ARGS%" ^ Review Comment: :) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
