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

Pulsar got closed by itself if I close the external terminal #979

Open
5 tasks done
zhaolinlau opened this issue Apr 16, 2024 · 9 comments
Open
5 tasks done

Pulsar got closed by itself if I close the external terminal #979

zhaolinlau opened this issue Apr 16, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@zhaolinlau
Copy link

Thanks in advance for your bug report!

  • Have you reproduced issue in safe mode?
  • Have you used the debugging guide to try to resolve the issue?
  • Have you checked our FAQs to make sure your question isn't answered there?
  • Have you checked to make sure your issue does not already exist?
  • Have you checked you are on the latest release of Pulsar?

What happened?

When I open a project through terminal using pulsar ., it does open the project with pulsar, but after that I close the terminal, at the same time the pulsar will be closed if I close the terminal.

Pulsar version

1.116.0

Which OS does this happen on?

🪟 Windows

OS details

11

Which CPU architecture are you running this on?

x86_64/AMD64

What steps are needed to reproduce this?

  1. manually add Pulsar to PATH
  2. open a terminal
  3. open a project through terminal using pulsar .
  4. now the project will be opened with pulsar
  5. close the terminal
  6. once the terminal being closed, it will auto close the pulsar

Additional Information:

No response

@zhaolinlau zhaolinlau added the bug Something isn't working label Apr 16, 2024
@confused-Techie
Copy link
Member

Thanks a ton for reporting this!

But, and someone feel free to correct me if I'm wrong, pretty sure this is expected behavior. When launching Pulsar from the command line that session then essentially owns the child process that is Pulsar.

So when the parent process is killed then of course it'll kill any child process'.

If it helps you can work around this within Windows itself by using something like pulsar . & exit which will launch Pulsar then immediately exit the shell for you, while keeping Pulsar running.

But otherwise I'm not sure if there's that much that can be done on our end to configure this behavior.

@savetheclocktower
Copy link
Sponsor Contributor

I'm betting that this is new behavior because @zhaolinlau has opened issues against this repo before and has probably used versions prior to 1.116.

@zhaolinlau, is this something that was behaving differently on Windows before 1.116?

@zhaolinlau
Copy link
Author

I'm betting that this is new behavior because @zhaolinlau has opened issues against this repo before and has probably used versions prior to 1.116.

@zhaolinlau, is this something that was behaving differently on Windows before 1.116?

Actually this is not a new behaviour, this issue occurred since the first release of the pulsar.

@savetheclocktower
Copy link
Sponsor Contributor

OK, cool. Thanks for the report.

Windows users: I'm curious if VSCode has the same behavior. If not, then it's within our ability to fix.

@zhaolinlau
Copy link
Author

Thanks a ton for reporting this!

But, and someone feel free to correct me if I'm wrong, pretty sure this is expected behavior. When launching Pulsar from the command line that session then essentially owns the child process that is Pulsar.

So when the parent process is killed then of course it'll kill any child process'.

If it helps you can work around this within Windows itself by using something like pulsar . & exit which will launch Pulsar then immediately exit the shell for you, while keeping Pulsar running.

But otherwise I'm not sure if there's that much that can be done on our end to configure this behavior.

Well this shouldn't be an expected behaviour because Atom and VsCodium don't have this issue.

@savetheclocktower
Copy link
Sponsor Contributor

It's also not the behavior of Pulsar or Atom on macOS or (I think) Linux, so we should aim for uniformity here.

@confused-Techie
Copy link
Member

So just checking this isn't the behavior on Atom's last released versions.

Although, launching Atom via the CLI also doesn't provide any output to the console of what's going on, unlike Pulsar which does show significant output.

I think it's the fact that we continually log output to the console that's doing us in. Unless we also do that on other platforms and it doesn't cause it to close there.

@DeeDeeG
Copy link
Member

DeeDeeG commented Apr 18, 2024

Maybe it's something to do with how electron-builder packages Pulsar, compared to how Atom or VS Code / vscodium are packaged.

Or perhaps Atom adds some launcher batch (.bat) script to the PATH, instead of the actual Electron binary as we're doing? I'm pretty sure Node and npm are usually added to PATH as batch (.bat)/powershell (.ps1) scripts, maybe there's a reason for it.

EDIT: It should be launching this, I believe: https://github.com/pulsar-edit/pulsar/blob/master/resources/win/pulsar.cmd

So we should make sure this .cmd script is what's being added to the PATH, and that the logic in the .cmd script properly allows the terminal to close without exiting Pulsar itself.

@confused-Techie
Copy link
Member

confused-Techie commented Apr 18, 2024

@DeeDeeG Looking into the .bat is a great idea, although I'll say it's probably not the fault of electron-builder as the output looks and behaves identical when running Pulsar for development via the CLI. So maybe it is possible we are having Pulsar be run as the EXE rather than the .bat


EDIT:

So running pulsar --version on my Windows shell after disabling @echo off in the pulsar.bat it does appear we are successfully utilizing the .bat file when running via the command line.

So seems extra strange this would break things as I don't think we've changed much of this file.
Actually checking the exact diffs between pulsar.cmd and atom.cmd the only change is in the name and location of the final EXE to launch. So the fault isn't of this file explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants