IO.puts does not seem to output to windows terminal

When mix run -e ‘MainMod.NamespacedMod.run([“args”])’ is used IO.puts does not get output to the terminal.

Is there anyway around this.

I have a hunch it is a windows issue, is anyone using windows who has not encountered this problem?

I’ve had to switch to virtual box, looks like windows isn’t optimal for elixir development?

I don’t like windows enough to keep it at the expense of learning to dev in elixir lol.

It’s good that other devs know that they may be better off using linux or macOS, unless they don’t mind getting wls and docker etc to facilitate deving in elixir.

I’ve just opted for a virtual machine and will transition away from windows in due time bGG.

  • I used virtualbox

  • Downloaded the debian-12.4.0-amd64-netinst.iso from the debian website (I prefer that version to the edu version because there are various aspect of debian that I like to configure myself, nothing advanced)

  • I Set 3d acceleration to disabled under display settings under virtual machine settings.

  • I set display memory to the maximum and display size to 1920 by 1080 under display settings under virtual machine settings.

  • I set the actual display settings from within the virtual machine to 1920 by 1080 under display settings.

The display settings tips are just to allow you to have a normal sized screen, I have other vm settings, but those are of course just according to my needs and resources.

  • I followed the elixir installation instructions for debian stated here

  • I followed the installation instructions for vscodium stated here; my neovim setup had some serious stability concerns.

  • After this you will need to do installations according to your need, for example git, okular etc.

Hope this helps anyone else. I had issues with window’s facilitation of elixir previously, but this one made me concerned about continuing on windows. I also did not want to use docker, wls and remote programming to continue on windows so I opted for virtualbox. VMware has been crashing for me lately.

For the record, as I forgot to mention, the IO.puts prints to terminal with this solution, so this is something of a resolution.

It seems that it generally is not, yes. We have a few posters who work hard to make it work well in Windows and help others but IMO it’s a lost battle (even though I also heard people literally making Windows services with Elixir underneath).

I say unless you want to dedicate part of your work time to pampering Windows specifics you’re much better off working in macOS or Linux.

1 Like

I’m one of those idiots that deploys to Windows and develops on all three platforms.

Your problem is not that IO.puts isn’t working, it is the sad story of escaping quotes on the command line I’m Windows, which is different depending on which terminal you’re using AFAIK.

1 Like

But when I do IO.puts with just an integer I still don’t get outputs.

I have read similar threads, but little strange bugs and dysfunctions keep creeping in, and I don’t want to get too far along and meet something that can’t be ignored. So yes I’ll be switching to linux as there seems to be better facilitation there.

I’ve not be a fan of bulk anyway.

When this call has no quotes in it, i.e. you’re not passing any args? e.g. MainMod.NamespacedMod.run()

Oh I see what you mean. What I was saying was that during troubleshooting a had various IO.puts in throughout the module and one or two were to output integers.

I did not get any errors from the unescaped quotation marks, but are you saying they blocked all IO.puts from outputting to the terminal?

No. If I understand correctly, what you’re typing into the terminal is not what the program is receiving, so nothing is being called.

You may type mix run -e ‘MainMod.NamespacedMod.run([“args”])’ but it might receive mix run -e ‘MainMod.NamespacedMod.run([args])’ or mix run -e ‘MainMod.NamespacedMod.run([’. If you’re wanting to eval or rpc from the command line you’re going to have to figure out the escape rules for whatever terminal you’re in. I wouldn’t bother tbh and would use Linux if this is how you want to work.

You’re not writing IO.puts(1) are you?

1 Like

We have a long running plan to reimplement the Elixir CLI for Windows in Powershell, because the current arg processing in .bat is sub-optimal. And Powershell would allow us to also test and run the boot scripts on macOS. That’s where most issues come from. Using WSL or any Unix based shell on Windows should be fine.

2 Likes

Huh? How so? What’s the connection?

Er, fixed. I meant to say boot scripts. :slight_smile:

1 Like

Still confusing, how can Windows’ PowerShell scripts be tested on macOS? Has PowerShell been ported to it?

It has been cross platform for a while now. It was originally called Poweshell Core but it’s just Poweshell now.

2 Likes

I’m on Windows and what I’ve found to be most effective is just spinning up WSL (version 2) using Ubuntu, doing my Elixir development there, and when I need to build a Windows release just pull the repo to the Windows side and do the build. I’m not trying to do anything else other than build on the Windows side.

If you’re using Visual Studio Code, the integration between the Windows VSC and WSL instance is really just handled for you out of box (last I used VSC). I don’t use VSC, so to use the tools I prefer (Sublime Text, DataGrip, etc), I access them through WSLg which is why I’m set on version 2. I do use Windows Terminal for most Linux access.

In effect, WSL2 is just running as a HyperV instance. What I like about doing this compared to other virtualization options in Windows is that it’s pretty well supported and included with Windows (at least Windows Pro, not sure about the others). Before WSLg was available, I used VMWare Workstation, which was certainly serviceable, but expensive and brought its own quirks.

As an aside, I’ve recently built some build scripts for my project using PowerShell (and targeting mostly my Linux environment, but expecting it to build the Windows release builds, too). Been very pleased with it. So I’m very supportive of PowerShell for scripting purposes.

3 Likes