Skip to content

Commit 838bd11

Browse files
author
Philip Sampaio
committed
Remove support for --pipe-to arg and ERTS_BIN env var
Since we are not planning to support releases for a while, we can simplify and remove these options.
1 parent cb20186 commit 838bd11

File tree

1 file changed

+3
-63
lines changed

1 file changed

+3
-63
lines changed

bin/elixir.ps1

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,9 @@ The following options are generally used under releases.
5555
--boot "FILE" Uses the given FILE.boot to start the system
5656
--boot-var VAR "VALUE" Makes `$VAR available as VALUE to FILE.boot (*)
5757
--erl-config "FILE" Loads configuration in FILE.config written in Erlang (*)
58-
--pipe-to "PIPEDIR" "LOGDIR" Starts the Erlang VM as a named PIPEDIR and LOGDIR
5958
--vm-args "FILE" Passes the contents in file as arguments to the VM
6059
61-
--pipe-to starts Elixir detached from console (Unix-like only).
62-
It will attempt to create PIPEDIR and LOGDIR if they don't exist.
63-
See run_erl to learn more. To reattach, run: to_erl PIPEDIR.
64-
65-
--pipe-to is not supported on Windows. If set, Elixir won't boot.
60+
--pipe-to is not supported via PowerShell.
6661
6762
** Options marked with (*) can be given more than once.
6863
** Standalone options can't be combined with other options.
@@ -260,28 +255,6 @@ for ($i = 0; $i -lt $allArgs.Count; $i++) {
260255
break
261256
}
262257

263-
"--pipe-to" {
264-
$runErlPipe = $allArgs[++$i]
265-
$runErlLog = $allArgs[++$i]
266-
267-
if ($null -eq $runErlPipe) {
268-
Write-Error "--pipe-to: PIPEDIR must be present"
269-
exit 1
270-
}
271-
272-
if ($null -eq $runErlLog) {
273-
Write-Error "--pipe-to: PIPELOG must be present"
274-
exit 1
275-
}
276-
277-
if ($runErlPipe.EndsWith("/") -or $runErlLog.EndsWith("/")) {
278-
Write-Error "--pipe-to: PIPEDIR and PIPELOG must not end with a slash"
279-
exit 1
280-
}
281-
282-
break
283-
}
284-
285258
Default {
286259
$private:normalized = NormalizeArg $arg
287260
$allOtherParams += $normalized
@@ -297,12 +270,6 @@ if ($null -eq $useIEx) {
297270
$beforeExtras = @("-pa", "$(Join-Path $scriptPath -ChildPath "../lib/elixir/ebin")") + $beforeExtras
298271
$beforeExtras = @("-noshell", "-elixir_root", "$(Join-Path $scriptPath -ChildPath "../lib")") + $beforeExtras
299272

300-
# One MAY change ERTS_BIN= but you MUST NOT change
301-
# ERTS_BIN=$ERTS_BIN as it is handled by Elixir releases.
302-
# TODO: change when we port the releases scripts.
303-
# $ERTS_BIN=
304-
$ERTS_BIN = "$env:ERTS_BIN"
305-
306273
$allParams = @()
307274

308275
if ($null -ne $env:ELIXIR_ERL_OPTIONS) {
@@ -325,40 +292,13 @@ if ($isWindows -or ($null -eq $isWindows)) {
325292

326293
$binPath = "$erlExec$binSuffix"
327294

328-
if ($ERTS_BIN) {
329-
$binPath = Join-Path -Path $ERTS_BIN -ChildPath $binPath
330-
}
331-
332-
if ($null -eq $runErlPipe) {
333-
# We double the double-quotes because they are going to be escaped by arguments parsing.
334-
$paramsPart = $allParams | ForEach-Object -Process { QuoteString($_ -replace "`"", "`"`"") }
335-
}
336-
else {
337-
$allParams.Insert(0, $binPath)
338-
339-
$erlExec = "run_erl"
340-
$binPath = "$erlExec$binSuffix"
341-
342-
if ($ERTS_BIN) {
343-
$binPath = Join-Path -Path $ERTS_BIN -ChildPath $binPath
344-
}
345-
346-
# We scape special chars using the Unix style of scaping, with "\".
347-
# But first we escape the double-quotes, because for some reason they are not escaped in the same regex.
348-
$private:escaped = $allParams | ForEach-Object -Process { ($_ -replace "`"", "\`"") -replace "[^a-zA-Z0-9_/-]", "\$&" }
349-
350-
# The args are surrounded here because we want to have only one argument for the entire command.
351-
$paramsPart = @("-daemon", "`"$runErlPipe/`"", "`"$runErlLog/`"", "`"$($escaped -join " ")`"")
352-
}
295+
# We double the double-quotes because they are going to be escaped by arguments parsing.
296+
$paramsPart = $allParams | ForEach-Object -Process { QuoteString($_ -replace "`"", "`"`"") }
353297

354298
if ($env:ELIXIR_CLI_DRY_RUN) {
355299
Write-Host "$binPath $paramsPart"
356300
}
357301
else {
358-
if ($runErlPipe) {
359-
$null = New-Item -Path "." -ItemType "directory" -Name "$runErlPipe" -Force
360-
$null = New-Item -Path "." -ItemType "directory" -Name "$runErlLog" -Force
361-
}
362302
$output = Start-Process -FilePath $binPath -ArgumentList $paramsPart -NoNewWindow -Wait -PassThru
363303
exit $output.ExitCode
364304
}

0 commit comments

Comments
 (0)