mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-21 10:35:56 +08:00
Display error message when windows launcher failed to start release (#1298)
This commit is contained in:
parent
093a466161
commit
a85dbb77f7
|
@ -9,8 +9,10 @@ defmodule AppBundler.Windows do
|
|||
{:ok, _} = Application.ensure_all_started(:ssl)
|
||||
{:ok, _} = Application.ensure_all_started(:inets)
|
||||
|
||||
app_name = options[:name]
|
||||
log(:green, :killing, "epmd.exe")
|
||||
System.cmd("taskkill.exe", ~w(/F /IM epmd.exe))
|
||||
|
||||
app_name = options[:name]
|
||||
app_path = "#{Mix.Project.build_path()}/#{app_name}-win"
|
||||
File.rm_rf!(app_path)
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<%
|
||||
|
||||
app_name = Keyword.fetch!(@app_options, :name)
|
||||
|
||||
additional_paths =
|
||||
for path <- Keyword.fetch!(@app_options, :additional_paths), into: "" do
|
||||
"root & \"\\" <> String.replace(path, "/", "\\") <> ";\" & "
|
||||
|
@ -25,14 +27,35 @@ Module Launcher
|
|||
Environment.SetEnvironmentVariable("PATH", <%= additional_paths%>Environment.GetEnvironmentVariable("PATH"))
|
||||
<% end %>
|
||||
|
||||
Dim cmd as String
|
||||
' try release rpc, if release is down, this will fail but that's ok.
|
||||
cmd = "echo " & input & " | """ & script & """ rpc ""AppBundler.__rpc__()"""
|
||||
Shell("cmd.exe /c " & cmd, 0)
|
||||
Dim rpcProc = new System.Diagnostics.Process()
|
||||
rpcProc.StartInfo.FileName = "cmd.exe"
|
||||
rpcProc.StartInfo.Arguments = "/c echo " & input & " | """ & script & """ rpc ""AppBundler.__rpc__()"""
|
||||
rpcProc.StartInfo.UseShellExecute = false
|
||||
rpcProc.StartInfo.CreateNoWindow = true
|
||||
rpcProc.Start()
|
||||
rpcProc.WaitForExit()
|
||||
|
||||
' try release start, if release is up, this will fail but that's ok.
|
||||
' rpc failed which usually means the release is down, let's start it
|
||||
If rpcProc.ExitCode <> 0 Then
|
||||
Environment.SetEnvironmentVariable("APP_BUILDER_INPUT", input)
|
||||
cmd = """" & script & """ start"
|
||||
Shell("cmd.exe /c " & cmd, 0)
|
||||
Dim startProc = new System.Diagnostics.Process()
|
||||
startProc.StartInfo.FileName = "cmd.exe"
|
||||
startProc.StartInfo.Arguments = "/c """ & script & """ start"
|
||||
startProc.StartInfo.UseShellExecute = false
|
||||
startProc.StartInfo.CreateNoWindow = true
|
||||
startProc.StartInfo.RedirectStandardError = true
|
||||
startProc.StartInfo.StandardErrorEncoding = System.Text.Encoding.UTF8
|
||||
startProc.Start()
|
||||
Dim errorMessage = startProc.StandardError.ReadToEnd()
|
||||
startProc.WaitForExit()
|
||||
|
||||
If startProc.ExitCode <> 0 Then
|
||||
MsgBox(
|
||||
"<%= app_name %> exited with error code " & startProc.ExitCode & "." & vbCrLf & errorMessage,
|
||||
MsgBoxStyle.Critical
|
||||
)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
End Module
|
||||
|
|
Loading…
Reference in a new issue