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

repl command fails on Windows #227

Closed
MuratOzsoyler opened this issue May 30, 2019 · 7 comments
Closed

repl command fails on Windows #227

MuratOzsoyler opened this issue May 30, 2019 · 7 comments

Comments

@MuratOzsoyler
Copy link

spago repl -- --port 3600 command fails on Windows.

This error is given:
spago.exe: purs: callProcess: does not exist (No such file or directory)

When I add the -v option to print the purs command executed output does not change.

purs command itself also results in the following error message, but apparently runs:
`purs repl: No input files; try running 'pulp psci' instead.
For help getting started, visit https://github.com/purescript/documentation/blob/master/guides/PSCi.md
Usage: For basic information, try the '--help' option.

I have installed the package as per spago README.md.

Any suggestions?

@f-f
Copy link
Member

f-f commented May 30, 2019

Hi @MuratOzsoyler, thanks for the report!

Some questions:

  • Have you run spago install before spago repl?
  • What version of spago are you on? (do spago version to know)

From the error it looks like spago cannot find purs, but you seem to be able to call purs directly so I'm a bit confused. Pinging some Windows users: @stkb @btrepp

@stkb
Copy link
Contributor

stkb commented May 31, 2019

Oh, yeah it'll be this old problem...

https://github.com/spacchetti/spago/blob/71c596af5e42d5c2691a57fe97143292d3308fcf/app/Spago/Purs.hs#L29-L35

For the repl command, purs is called with callProcess, except @MuratOzsoyler likely has PureScript installed with NPM, meaning there isn't a purs process, only purs.cmd.

In all the other commands, purs is called under a shell, so it works.

A workaround is download the PureScript binary directly; extract the purs.exe file from there and put it on your path, or install PureScript with Chocolatey or Scoop

@f-f
Copy link
Member

f-f commented May 31, 2019

psc-package has this piece of code that makes it work I guess, should we port it?

@stkb
Copy link
Contributor

stkb commented May 31, 2019

@f-f I was already working on a quick fix that simply replaced the callProcess with callCommand, but that psc-package way is definitely another way to do it.

The Purs.hs module could do with some rewriting anyway as there's quite a bit of repetition there. Currently most of the code uses a runInShell cmd pattern rather than runProcess path args. Is there a reason to go with one over the other?

Another scenario we should make sure we support: If purescript is installed locally to the project under npm then we should run that version and not the global one. I think one of these PS tools had code for that, but I forget which one.

@MuratOzsoyler
Copy link
Author

Thank you for prompt replies. purs.exe solved the problem.

I also admire the speed of commiting a quick fix by the way 👍

@f-f
Copy link
Member

f-f commented May 31, 2019

@MuratOzsoyler you're welcome 🙂 (and thanks @stkb!)

@f-f
Copy link
Member

f-f commented May 31, 2019

@stkb re runInShell vs runProcess: honestly I don't remember the rationale, when I coded that module I just wanted to get things to work. I'd be fine with a rewrite of the Purs module, it's a bit messy at the moment 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants