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

Build/run command gets stuck and can't be killed if "pause" is called on Windows #311

Open
fbjerno opened this issue Feb 19, 2024 · 2 comments

Comments

@fbjerno
Copy link

fbjerno commented Feb 19, 2024

Describe the bug
If a build command or run command results in the cmd command 'pause' being called (on Windows), the build output will be stuck as the command is waiting for user input it will never get. The 'Build: Kill Running Command' command does not seem able to kill the process in this case.

For example, putting 'pause' in a .bat file and setting that .bat file as the run command will cause this behaviour.
Similarly, a C/C++ program which calls system("pause"); will cause the same behaviour if it is set as the run command.

It is worth pointing out that a C/C++ program calling _getch() (a function which waits for and returns the keycode of the next key entered by the user) will similarly freeze the build output, but will yield to 'Build: Kill Running Command'.

Attempting to switch workspaces while the build window is stuck causes Focus to freeze, and so the only way to restore the ability to build after it gets stuck is to restart Focus.

As far as I can tell the build timeout setting does not have any effect in this case.

To Reproduce
Steps to reproduce the behavior:

  1. Make a .bat file containing the cmd command 'pause'
  2. Make a project and make a build command that calls the .bat file
  3. Run the build command.

Expected behavior
'Build: Kill Running Command' successfully forces the build to stop.
If you try to switch workspaces while the build is stuck on 'pause', the editor should give the user some prompt asking them what to do as the build is still in progress, or forcibly stop the build.
Probably the build timeout should also correctly stop the build after the given number of seconds in this case.

  • OS: Windows 10

  • Focus Version: 0.3.0 (sorry! I guess I forgot to update it on my home PC. Might check if this bug still exists on 0.3.1 later, but I suspect it shouldn't make a difference as the bug is pretty specific)

@focus-editor
Copy link
Owner

Can't reproduce on 0.3.1 - see attached gif

pause-kill

Please try 0.3.1 and let us know if the bug is still there

@fbjerno
Copy link
Author

fbjerno commented Feb 24, 2024

On 0.3.2 the bug doesn't happen with the .bat script, but my C++ program which calls system("pause"); still refuses to shut down when I use kill running command. I'd guess this might be to do with system() spawning a new process?

image

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

No branches or pull requests

2 participants