Sublime Forum

End long running plugin

#1

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.

0 Likes

#2

Apologies for the bump, I’m still looking for an answer to this.

0 Likes

#3

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.

0 Likes

#4

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

0 Likes

#5

+1

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

there is many good tools base nodejs like uglifyjs

0 Likes

#6

@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 Help with some plugin development questions

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.

0 Likes

#7

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.

0 Likes