Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run an Elixir escript on Windows 8.1

I'm creating a mix escript, and all seems well, but I can't invoke the generated escript executable.

>mix escript.build

lib/cmdlineutil.ex:2: warning: variable args is unused
Compiled lib/cmdlineutil.ex 
Generated cmdlineutil.app 
Consolidated Access
Consolidated Collectable 
Consolidated Enumerable 
Consolidated Inspect
Consolidated List.Chars 
Consolidated Range.Iterator 
Consolidated String.Chars 
Consolidated protocols written to _build/dev/consolidated
Generated escript cmdlineutil with MIX_ENV=dev

>cmdlineutil

'cmdlineutil' is not recognized as an internal or external command, operable program or batch file.

>mv cmdlineutil cmdlineutil.exe

>cmdlineutil.exe

This version of C:\Git\elixir\cmdlineutil\cmdlineutil.exe is not compatible with the version of Windows that you're running. Check your computer's system information and then contact the software publisher.

Message box:

Unsupported 16-Bit Application

The program or feature "\??\C:\Git\elixir\cmdlineutil\cmdlineutil.exe" cannot start or run due to incompatibility with 64-bit versions of Windows. Please contact the software vendor to ask if a 64-bit Windows compatible version is available.

lib\cmdlineutil.ex:

defmodule CmdLineUtil.Echo do
    def main(args) do
        IO.puts "Hello!"
    end
end

mix.exs:

defmodule CmdLineUtil.Echo.Mixfile do
  use Mix.Project

  def project do
    [app: :cmdlineutil,
     version: "0.0.1",
     elixir: "~> 1.0.0",
     escript: escript,
     deps: deps]
  end

  def escript do
    [main_module: CmdLineUtil.Echo]
  end

  # Configuration for the OTP application
  #
  # Type `mix help compile.app` for more information
  def application do
    [applications: [:logger]]
  end

  # Dependencies can be Hex packages:
  #
  #   {:mydep, "~> 0.3.0"}
  #
  # Or git/path repositories:
  #
  #   {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
  #
  # Type `mix help deps` for more examples and options
  defp deps do
    []
  end
end
like image 203
10 cls Avatar asked Oct 26 '14 02:10

10 cls


1 Answers

Theres an escript command installed with Erlang.

>escript cmdlineutil

like image 151
10 cls Avatar answered Oct 05 '22 22:10

10 cls