sublime-text-virtualenv icon indicating copy to clipboard operation
sublime-text-virtualenv copied to clipboard

cancel build

Open udybrill opened this issue 10 years ago • 10 comments

When running a python file using the virtualenv package, it is not possible to cancel the build using the 'Cancel Build' button located in Tools tab

udybrill avatar Jan 19 '15 17:01 udybrill

I noticed this too.

tigeryell99 avatar Mar 05 '15 17:03 tigeryell99

Package is great so far... but as commented already few months ago it's not possible to "Cancel build" when running a long execution python script. Anyone found a fix for this?

Thanks.

brupelo avatar Apr 13 '16 19:04 brupelo

Any update on this?

bgromov avatar Jan 16 '18 03:01 bgromov

I've stopped using this package long time ago but adding a cancel option is just trivial, something like this would probably do:

def run(self, **kwargs):
    if kwargs.get("kill", False):
        return super().run(**kwargs)

Just take a look to ExecCommand to see what that kill arguments means, hope that helps.

brupelo avatar Jan 16 '18 04:01 brupelo

@brupelo Thanks! I will have a look.

bgromov avatar Jan 17 '18 22:01 bgromov

Solved it! :-) It's just a matter of adding "cancel": {"kill": true} to the build file!

PR - #14


If you want to fix it in your current version:

  • install PackageResourceViewer
  • open the Tools menu, and select PackageResourceViewer: Open Resource
  • navigate to virtualenv -> Python + Virtualenv.sublime-build
  • in the build file, add "cancel": {"kill": true} (don't forget to add a coma at the end of the line just above, i.e. the selector line)

gregsadetsky avatar Mar 30 '18 00:03 gregsadetsky

@gregsadetsky Didn't work for me unfortunately. It gives an error:

__init__() got an unexpected keyword argument 'cancel'

What version of Sublime are you using? I am on v3, build 3143.

bgromov avatar Apr 02 '18 18:04 bgromov

@bgromov hmm, strange...! I'm running build 3160

Would you mind trying it in that build and letting me know if that works? Thanks!

gregsadetsky avatar Apr 03 '18 18:04 gregsadetsky

@gregsadetsky I am using unregistered version so far, so dev builds are not available for me, at least that's what the official web-site says. Build 3143 is the latest official release.

bgromov avatar Apr 04 '18 10:04 bgromov

@gregsadetsky, thanks this worked perfectly for me, I also added "quiet": true

Phuket2 avatar Nov 06 '18 09:11 Phuket2