@Throws(IOException::class) fun createCmds(runConfiguration: ChromeRunnerRunOptions): Array<String?>? { val commands: ArrayList<String> = ArrayList() commands.add(nodeJsBinary.get().getBinaryAbsolutePath()) val nodeOptions = System.getProperty(NODE_OPTIONS) if (nodeOptions != null) { for (nodeOption in nodeOptions.split(" ".toRegex()).dropLastWhile { it.isEmpty() } .toTypedArray()) { commands.add(nodeOption) } } val elfData: StringBuilder = getELFCode( runConfiguration.getInitModules(), runConfiguration.getExecModule(), runConfiguration.getExecutionData() ) val elf: File = createTempFileFor(elfData.toString()) commands.add(elf.getCanonicalPath()) return commands.toArray(arrayOf()) }
Creates commands for calling Node.js on command line . Data wrapped in passed parameter is used to configure node itself , and to generate file that will be executed by Node .