Sublime Forum

How to stop/cancel a cucumber/ruby test when running from Sublime Text 3 (in Windows)?

#1

I am able to launch a Cucumber/Ruby test from Sublime 3 in Windows by right clicking and choosing Ruby Test-Run Single Test.

Things brings up the Test Panel with the results, but how can I cancel this execution and stop it from keep on running?

I’ve tried: ctrl+z, ctrl+x, ctrl+c, ctrl+pause_break, ctrl+delete, esc, delete, pause_break, but the test keep on running and you need to wait until it’s all done…

I was pressing those keys either in the Test Panel, the console, or the main screen with code.

If you know what I could try pls?

0 Likes

#2

Do you tried Tools -> Cancel Build?

On my screen shot it is disabled because there is none build running.
From where did you get this Cucumber/Ruby test from Sublime 3?
Is it a default or there is some third part package for it?
If there is a third part package, it should there is a documentation and in there may be explaining how to stop it.

3 Likes

#3

note that depending how the tests run, Cancel Build may not help due to this bug:

2 Likes

#4

Thanks, I had not realized that this could be from the plugin.

I’ve asked the question here now: https://github.com/maltize/sublime-text-2-ruby-tests/issues/268 , as they don’t seem to have much documentation.

‘Cancel Build’ is disabled for me even when the tests are running, so not sure how they’ve done it.

0 Likes

#5

The package utilizes the exec command, so in theory it should be cancellable.

In practice, there may be a few reasons why the test runner isn’t terminated, and the one that @kingkeith mentioned is one of them.

2 Likes

#6

Although ‘Cancel Build’ is disabled for this plugin when tests are running, so even if the issue mentioned above gets fixed, I don’t see how one could terminate a running programme.

Is there a combination of letters or a command that can be typed in some kind of console to force stop/kill whatever is running?

0 Likes

#7

I would just to open my task manager and kill the Sublime Text process children.

0 Likes

#8

@addosn_zz, I thought really good idea when I read the comment, but I’m now trying at home and… when I launch sublime on windows, it creates a process called ‘sublime_text.exe’ (under the details tab of my task manager), the problem is that if I right-click, select run ‘Ruby Test - Run single test’, it doesn’t create any other process that I can see. So I don’t think I can kill anything there?

Or is there a way in Windows to kill all children processes if I know the PID of this main ‘sublime_text.exe’ process?

0 Likes

#9

I presume you are looking at the Processes tab and not the Applications tab? If there are no processes being created, that would be a reason that Cancel Build wouldn’t work. The other reason is if the processes started by the exec command creates a new process group from the shell, and then the shell exits. At that point the child process started by Sublime Text has ended and there is nothing that can be cancelled.

You probably don’t want to do this since it would kill plugin_host, which would cause a large percentage of functionality to stop working until Sublime Text is restarted.

0 Likes

#10

In Windows 10, I can just see Sublime under Processes tab, but I was looking under Details tab, which has a long list of every running process. This is where I don’t see any new sublime task created when I run those ruby tests.

Now that you mentioned it, I saw a cmd.exe and conhost.exe created, if I killed any or both of them individually with ‘kill task’, the processes were still running in the background.

But, if I select ‘End Process Tree’ when clicking the ‘cmd.exe’ file that seems to kill the execution, so finally got it working for now.

Not ideal, to have a task manager running and killing it this way but at least we found out how to stop them.

Thank you very much for the help guys!!

1 Like