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

feat: launch REPL as own shell #374

Merged
merged 5 commits into from
Mar 5, 2024
Merged

Conversation

sockmaster27
Copy link
Contributor

Fixes #372

@sockmaster27
Copy link
Contributor Author

Sorry for the large diff.
This change required modifications to many of the dead handlers, and I thought it might finally be time to kill them, rather than make more untestable changes.

@magnus-madsen
Copy link
Member

Sorry for the large diff. This change required modifications to many of the dead handlers, and I thought it might finally be time to kill them, rather than make more untestable changes.

OK. I take a look.

@magnus-madsen
Copy link
Member

magnus-madsen commented Mar 4, 2024

How can it work without shell quote?
Does VSCode escape weird path names?

Can you try to create an absurd path and open it in VSCode? (E.g. a path with lots of spaces and special chars and quotes)

client/src/handlers/handlers.ts Outdated Show resolved Hide resolved
client/src/handlers/handlers.ts Show resolved Hide resolved
client/src/handlers/handlers.ts Show resolved Hide resolved
@sockmaster27
Copy link
Contributor Author

This happens when Ctrl+C is pressed

image

@sockmaster27
Copy link
Contributor Author

How can it work without shell quote? Does VSCode escape weird path names?

Can you try to create an absurd path and open it in VSCode? (E.g. a path with lots of spaces and special chars and quotes)

This is as strange as Windows is allowing me to go and it works just fine:
image

@magnus-madsen
Copy link
Member

What happens if you:

  • click Run Main
  • ctrl + c
  • click Run Main?

Does it open a new terminal as hoped?

@magnus-madsen
Copy link
Member

How can it work without shell quote? Does VSCode escape weird path names?
Can you try to create an absurd path and open it in VSCode? (E.g. a path with lots of spaces and special chars and quotes)

This is as strange as Windows is allowing me to go and it works just fine: image

Okay. Wow. I guess maybe it is escaped?

@magnus-madsen
Copy link
Member

Where does the exit code -107... come from?

I assume if you type :exit in the repl something else happens?

@sockmaster27
Copy link
Contributor Author

Okay. Wow. I guess maybe it is escaped?

My guess would be that it isn't necessary if the process is started directly without going through a shell:
https://nodejs.org/api/child_process.html#child_processspawncommand-args-options

@sockmaster27
Copy link
Contributor Author

What happens if you:

* click `Run Main`

* ctrl + c

* click `Run Main`?

Does it open a new terminal as hoped?

Yes

@magnus-madsen
Copy link
Member

What happens if you:

* click `Run Main`

* ctrl + c

* click `Run Main`?

Does it open a new terminal as hoped?

Yes

Ok, so it would seem that "it works well"?

@magnus-madsen
Copy link
Member

In addition, can you try two things:

  • What happens if the Flix program terminates with an error (try main with ???)
  • What happens if the Flix program calls System.exit (you will need import static ...`)
  • What happens if the Flix program loops (you can just write a tail recursive function that calls itself).

@sockmaster27
Copy link
Contributor Author

Where does the exit code -107... come from?

I assume if you type :exit in the repl something else happens?

That exit code seems to be mean that the process has been 'forced' to quit via Ctrl+C.
Quitting it normally is equivalent to just closing it.

@magnus-madsen
Copy link
Member

But what happens with :exit? is it different from ctrl+c is my question

@sockmaster27
Copy link
Contributor Author

In addition, can you try two things:

* What happens if the Flix program terminates with an error (try main with `???`)

* What happens if the Flix program calls `System.exit` (you will need import static ...`)

* What happens if the Flix program loops (you can just write a tail recursive function that calls itself).
  • The error is correctly reported in the shell and it continues to live on.
  • Unfortunately, exits the terminal:
    image
  • Terminal becomes unresponsive until killed via Ctrl+C or the trash icon.

@sockmaster27
Copy link
Contributor Author

But what happens with :exit? is it different from ctrl+c is my question

It just quits the shell gracefully and hides the panel.

@sockmaster27
Copy link
Contributor Author

Ok, so it would seem that "it works well"?

Other than the ugly error reporting, yes.

@magnus-madsen magnus-madsen merged commit 86ddd7c into flix:master Mar 5, 2024
4 checks passed
@sockmaster27 sockmaster27 deleted the shell branch March 5, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use createTerminal to launch the Flix terminal?
2 participants