Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#608] Windows fix for <app> console #626

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions priv/libexec/commands/win/console.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Run the app in console mode
$bin = whereis-erts-bin
$werl = (join-path $bin werl)
$erl = (join-path $bin "erl.exe") #get erl.exe as werl.exe will open a new window

$boot = (join-path $Env:REL_DIR $Env:REL_NAME)

$argv = @("-boot", $boot)
$argv += @("-config", $Env:SYS_CONFIG_PATH)
$argv += @("-args_file", $Env:VMARGS_PATH)
$argv = @("-boot", "`"$boot`"")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own edification, could you explain the changes here? I'm going to merge them, I'd just like to know what I need to be doing differently or how I should be reasoning about quoting here; I'm working with PS Core for the most part, and I know there are differences with previous versions of PS, but from a maintenance standpoint I can't work with both, so Core is what I've stuck with, do these changes make any assumptions in that regard?

Copy link
Author

@artman41 artman41 Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the difference here is that we wrap the $boot in quotes so that paths containing a space work as intended, rather than acting as independent args 👍

we also wrap the other args in quotes just in case

$argv += @("-config", "`"$Env:SYS_CONFIG_PATH`"")
$argv += @("-args_file", "`"$Env:VMARGS_PATH`"")
$argv += @("-user", "Elixir.IEx.CLI")
$argv += @("-extra", "--no-halt", "+iex")

Expand All @@ -18,6 +18,6 @@ $post_start = {
}

# Run post-start hooks asynchronously
start-job -Name "post_start hooks" -ScriptBlock $post_start
start-job -Name "post_start hooks" -ScriptBlock $post_start | out-null # hide the output from start-job

& $werl @argv
start-process "$erl" -ArgumentList "$argv" -Wait -NoNewWindow #execute the application in the current shell window
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My impression was that werl is the only "true" Erlang shell, the command-line version is considerably simpler, missing many of the useful features - has that changed? I would expect someone would want the proper shell when attaching a console in production. Thoughts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly I'm incorrect but I was under the assumption that the two were identical, in the case that they are not, it may be a good idea to have an optional config flag

3 changes: 2 additions & 1 deletion priv/templates/release_rc_win_exec.eex
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ where pwsh >nul 2>nul
if %ERRORLEVEL% equ 0 (
set prog=pwsh
)
%prog% -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command "& "%boot_script%" @args" %*
%prog% -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command "& '%boot_script%' @args" %*