Skip to content

Commit 13acfdb

Browse files
authored
Add correct iex cli parameters for elixir v1.17+ (#3698)
Fixes #3673
1 parent 5890bcc commit 13acfdb

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/org/elixir_lang/IEx.kt

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import org.elixir_lang.Elixir.prependNewCodePaths
88

99
object IEx {
1010
fun commandLine(
11-
environment: Map<String, String>,
12-
workingDirectory: String?,
13-
elixirSdk: Sdk,
14-
erlArgumentList: kotlin.collections.List<String>
11+
environment: Map<String, String>,
12+
workingDirectory: String?,
13+
elixirSdk: Sdk,
14+
erlArgumentList: kotlin.collections.List<String>
1515
): GeneralCommandLine {
1616
/* `iex` is an alternative mode of the `elixir` script, which changes the `erl` options, so the state needs to
17-
be built on top of `erl`, not `elixir`. */
17+
* be built on top of `erl`, not `elixir`. */
1818
val erlangSdk = elixirSdkToEnsuredErlangSdk(elixirSdk)
19-
val commandLine = org.elixir_lang.Erl.commandLine(true, environment, workingDirectory, erlangSdk)
19+
val commandLine = Erl.commandLine(true, environment, workingDirectory, erlangSdk)
2020
prependNewCodePaths(commandLine, elixirSdk, erlangSdk)
2121
commandLine.addParameters("-elixir", "ansi_enabled", "true")
2222
commandLine.addParameters(erlArgumentList)
@@ -31,22 +31,32 @@ object IEx {
3131

3232
val elixirVersion = elixirSdk.versionString?.let { Version.parseVersion(it) }
3333
if (elixirVersion?.lessThan(1, 15, 0) == true) {
34-
/* Pre Elixir 1.15.0, IEx entrypoint was as Elixir.IEx.CLI start() */
34+
/* Pre Elixir 1.15.0, IEx entrypoint was as Elixir.IEx.CLI start()
35+
* Pattern: erl -pa <multiple-paths> -noshell -user Elixir.IEx.CLI -extra --no-halt +iex */
3536
commandLine.addParameters("-user", "Elixir.IEx.CLI")
3637
commandLine.addParameter("-extra")
3738
} else if (elixirVersion?.`is`(1, 15, 0) == true) {
3839
/* Weird case for 1.15.0-rc1 to 1.15.0
39-
* It had a bugged start_iex that needs to be specified differently. */
40+
* It had a bugged start_iex that needs to be specified differently.
41+
* Pattern: erl -pa <multiple-paths> -noshell -user Elixir.IEx.CLI -extra --no-halt +iex
42+
*/
4043
commandLine.addParameters("-s", "elixir", "start_cli")
4144
commandLine.addParameters("-user", "elixir")
4245
commandLine.addParameter("-extra")
4346
commandLine.addParameters("-e", ":elixir.start_iex()")
44-
} else {
45-
/* Case for elixir 1.16.0+ (and 1.15.1+ from the 1.15 branch).
46-
* We can call start_iex directly from elixir entrypoint. */
47+
} else if (elixirVersion?.lessThan(1, 17, 0) == true) {
48+
/* Elixir 1.15.1 - 1.16.x series (e.g., 1.15.1, 1.16.3)
49+
* Pattern: erl -noshell -elixir_root elixir/lib -pa elixir/lib/elixir/ebin -s elixir start_iex -user elixir -extra --no-halt +iex
50+
*/
4751
commandLine.addParameters("-s", "elixir", "start_iex")
4852
commandLine.addParameters("-user", "elixir")
4953
commandLine.addParameter("-extra")
54+
} else { // elixirVersion.isAtLeast(1, 17, 0)
55+
/* Elixir 1.17.x - 1.19.x and potentially future versions if the pattern continues
56+
* Pattern: erl -noshell -elixir_root elixir/lib -pa elixir/lib/elixir/ebin -user elixir -extra --no-halt +iex
57+
*/
58+
commandLine.addParameters("-user", "elixir")
59+
commandLine.addParameter("-extra")
5060
}
5161
commandLine.addParameter("+iex")
5262
}

0 commit comments

Comments
 (0)