For me, moving string to `scriptInvocationFormat` is confusing as it is tightly coupled to the caller for knowing what `%s` was used. If you want to move it to own method, then I'd pass in the port + filename to this method.