arclanguage / anarki

Community-managed fork of the Arc dialect of Lisp; for commit privileges submit a pull request.
http://arclanguage.github.io
Other
1.17k stars 160 forks source link

Anarki hangs when starting on Windows via arc.cmd #217

Open xenogl opened 2 years ago

xenogl commented 2 years ago

When I try to start Anarki via arc.cmd on windows 10, a command prompt opens, but only the blinking cursor is visible and it waits endlessly. Only when I press some key (e.g. space), the text "initializing arc... (may take a minute)" appears. After about 30 seconds the arc prompt appears. But, if I now type something in that prompt (say, number 1) nothing happens, as if repl doesn't work at all. This was tested on Racket version 8.7

akkartik commented 2 years ago

I don't have a solution but I do see similar problems. I'm on Windows 11. I have to press enter, space doesn't help. Then I see an error about not finding collection sha.

akkartik commented 2 years ago

Ah, I forgot the raco pkg install sha

Now I can reproduce the second half of your report as well. And when I hit Ctrl+d I get this error:

char-whitespace?: contact violation
expected: char?
given: #<eof>
akkartik commented 2 years ago

One issue: Racket's (char-ready?) hangs on Windows where it immediately returns on Linux.

There may be others.

xenogl commented 2 years ago

One issue: Racket's (char-ready?) hangs on Windows where it immediately returns on Linux.

There may be others.

How to solve this problem, what shoud I do?

akkartik commented 2 years ago

I'm not sure. I'm not an expert in Windows or Racket. I'm poking at the problem when I have some time. Let's see if others have ideas as well.

I don't see any discussion online that Racket's char-ready? misbehaves on Windows, but I tested it in isolation outside of Anarki and saw the same behavior. Racket's documentation does say:

..byte-ready? and char-ready? are rarely the right choice.

I wonder now if trash-whitespace was just a bad idea. It was introduced in https://github.com/arclanguage/anarki/commit/421c700e6d4605abf2b3f21180b90311f76f668c, and there have only been a couple of changes to it since. I suspect the initial commit.

I'm not at my Windows machine right now, but try deleting this line and see if it helps.

akkartik commented 2 years ago

Though I don't think this explains why it hangs waiting for the initial key. Well, let's fix the second problem first.

xenogl commented 2 years ago

I'm not at my Windows machine right now, but try deleting this line and see if it helps.

Yes, it helps: now I can type in repl. But, i still got that hang on startup, where I have to press enter key first to get initial message "initializing arc... (may take a minute)". I cannot figure out how to fix this.

And second, what keystroke I should use to break back to repl when I want to break some unwanted long computation? (Ctrl-c exit from arc entirely, but i want only to break back to repl)

akkartik commented 2 years ago

I think that ctrl+c might be a known issue..

For the first key, I'd try inserting some prints (display in Racket) between lines in the anarki-windows-cli function in the boot.rkt file. Try to figure out precisely what line causes it to wait for keyboard input.

xenogl commented 2 years ago

I think that ctrl+c might be a known issue..

For the first key, I'd try inserting some prints (display in Racket) between lines in the anarki-windows-cli function in the boot.rkt file. Try to figure out precisely what line causes it to wait for keyboard input.

Something really strange happens here: when I run Anarki from the command line, not via a .cmd file, like this:

c:\Anarki>racket -t boot.rkt -e "(anarki-windows-cli)"

then everything works ok and there is no initial hang.

The problem only appears when Anarki is started via a .cmd file! I don't know how to explain this.

akkartik commented 2 years ago

Wow! Good find.