Home Download Buy Blog Forum Support

End long running plugin

End long running plugin

Postby tanepiper on Sun Nov 06, 2011 6:48 am

Hi there,

With nodejs being released on Windows, I would like to create a plugin that runs the current script, in the context of a opened folder.

I've got the nodejs command working find (I based it off JSHint) but I can't find anything on once the process is running, how to get that as something to attach to and be able to cancel with a key like Ctrl + C (as an example I'm aware this is copy).

Any help would be appreciated. Sublime is an excellent editor, and I'm hoping to buy soon - certainly if I can improve my work flow with this plugin.
tanepiper
 
Posts: 68
Joined: Sun Nov 06, 2011 6:40 am

Re: End long running plugin

Postby tanepiper on Sun Nov 13, 2011 1:06 am

Apologies for the bump, I'm still looking for an answer to this.
tanepiper
 
Posts: 68
Joined: Sun Nov 06, 2011 6:40 am

Re: End long running plugin

Postby jps on Mon Nov 14, 2011 10:37 pm

Assuming you're spawning a separate process for this, there's no reason you can't run that process async. Take a look at Default/exec.py for an example of this.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: End long running plugin

Postby tanepiper on Mon Nov 14, 2011 11:04 pm

Can you also suggest an example of a plugin that uses this, so I can see how it's invoked, so I can change my code to potentially support it as I would prefer async control
tanepiper
 
Posts: 68
Joined: Sun Nov 06, 2011 6:40 am

Re: End long running plugin

Postby leecade on Tue Nov 15, 2011 7:53 am

+1

I want know how nodejs work with sublime in mac too.

there is many good tools base nodejs like uglifyjs
leecade
 
Posts: 14
Joined: Thu Nov 10, 2011 10:26 pm

Re: End long running plugin

Postby tanepiper on Tue Nov 15, 2011 1:32 pm

@leecade - Yes thats the plan, I'd like to have nodejs commands that you can call, such as lint and uglify and ender which you can call on your file or directory.

The problem is I need a way to be able to cancel these processes, it's related to this viewtopic.php?f=6&t=3742

I've managed to get quite a bit done, from autocompletions, snippets, commands and menus and running nodejs as a command, including debug and arguments. At the moment, it outputs to the console or to a new file window I create that is read only. Ideally I'd like to have a quick window that can be called to show processes and allow the user to kill them. At the moment I'm having to kill -9 each process.
tanepiper
 
Posts: 68
Joined: Sun Nov 06, 2011 6:40 am

Re: End long running plugin

Postby jps on Thu Nov 17, 2011 10:28 pm

The exec command is used by the build systems.

Your best bet for examples is to google for how to use the subprocess module in Python - there's nothing different about using it within a plugin, apart from $PATH being mostly empty on OS X.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm


Return to Plugin Development

Who is online

Users browsing this forum: Clams and 8 guests