modules/tests/test-integration/src/test/java/org/ballerinalang/test/context/ServerInstance.java
private void startProcess(String[] args) throws IOException {
        String scriptName = Constant.BALLERINA_SERVER_SCRIPT_NAME;
        String[] cmdArray;
        File commandDir = new File(serverHome);
        if (Utils.getOSName().toLowerCase().contains("windows")) {
            commandDir = new File(serverHome + File.separator + "bin");
            cmdArray = new String[]{"cmd.exe", "/c", scriptName + ".bat" , "run", "service"};
            String[] cmdArgs = Stream.concat(Arrays.stream(cmdArray), Arrays.stream(args))
                    .toArray(String[]::new);
            process = Runtime.getRuntime().exec(cmdArgs, null, commandDir);

        } else {
            cmdArray = new String[]{"bash", "bin/" + scriptName, "run", "service"};
            String[] cmdArgs = Stream.concat(Arrays.stream(cmdArray), Arrays.stream(args))
                    .toArray(String[]::new);
            process = Runtime.getRuntime().exec(cmdArgs, null, commandDir);
        }
    }
/**
     * Executing the sh or bat file to start the server.
     *
     * @param args - command line arguments to pass when executing the sh or bat file
     * @throws IOException
     */
Executing the sh or bat file to start the server.
@param args - command line arguments to pass when executing the sh or bat file
@throws IOException
Executing the sh or bat file to start the server . @param args - command line arguments to pass when executing the sh or bat file @throws IOException
private void startProcess(String[] args) throws IOException {
        String scriptName = Constant.BALLERINA_SERVER_SCRIPT_NAME;
        String[] cmdArray;
        File commandDir = new File(serverHome);
        if (Utils.getOSName().toLowerCase().contains("windows")) {
            commandDir = new File(serverHome + File.separator + "bin");
            cmdArray = new String[]{"cmd.exe", "/c", scriptName + ".bat" , "run", "service"};
            String[] cmdArgs = Stream.concat(Arrays.stream(cmdArray), Arrays.stream(args))
                    .toArray(String[]::new);
            process = Runtime.getRuntime().exec(cmdArgs, null, commandDir);
        } else {
            cmdArray = new String[]{"bash", "bin/" + scriptName, "run", "service"};
            String[] cmdArgs = Stream.concat(Arrays.stream(cmdArray), Arrays.stream(args))
                    .toArray(String[]::new);
            process = Runtime.getRuntime().exec(cmdArgs, null, commandDir);
        }
    }
private void startProcess ( String [ ] args ) throws IOException { String scriptName = Constant . BALLERINA_SERVER_SCRIPT_NAME ; String [ ] cmdArray ; File commandDir = new File ( serverHome ) ; if ( Utils . getOSName ( ) . toLowerCase ( ) . contains ( "windows" ) ) { commandDir = new File ( serverHome + File . separator + "bin" ) ; cmdArray = new String [ ] { "cmd.exe" , "/c" , scriptName + ".bat" , "run" , "service" } ; String [ ] cmdArgs = Stream . concat ( Arrays . stream ( cmdArray ) , Arrays . stream ( args ) ) . toArray ( String [ ] :: new ) ; process = Runtime . getRuntime ( ) . exec ( cmdArgs , null , commandDir ) ; } else { cmdArray = new String [ ] { "bash" , "bin/" + scriptName , "run" , "service" } ; String [ ] cmdArgs = Stream . concat ( Arrays . stream ( cmdArray ) , Arrays . stream ( args ) ) . toArray ( String [ ] :: new ) ; process = Runtime . getRuntime ( ) . exec ( cmdArgs , null , commandDir ) ; } }
Executing the sh or bat file to start the server.
Executing the sh or bat file to start the server .