Sublime Forum

Persistent Command Window

#1

I’m interested in writing some utility scripts for SASS to do a few simple things. Is there a way to run a command in the command line and make the window persistent? Essentially I’d like to run something along these lines:
‘sass --watch $file_path:$file_path’

The reason I want to do this is because sass leaves a session open watching the directory for changes which needs to be closed through the command line. If there’s a better way to do this, I’m open for ideas.

0 Likes

#2

Could you explain a bit more what you mean by a persistent window?

0 Likes

#3

Generally the command window is suppressed when running commands (cmd.exe) within sublime. Is there a way to run a command, open the cmd window, and keep the window open?

0 Likes

#4

I’d like to know how to do this too.

Taking it further, as a feature request, I’d like to be able to send commands to that open window arbitrarily as well.

0 Likes

#5

It’s not something I’m planning on adding (it’s very much a win32 only thing: on linux and osx sub processes are just spawned as is, without any equivalent of cmd.exe being involved), but you could make a build system that runs “cmd.exe /c start my_real_command.bat”, and you’d get a stand alone window.

0 Likes

#6

I’ll play around with that and see where I get. Thanks Jon.

0 Likes

#7

+1.
would love to be able to send commands to that open window too. On linux. basically spawn a shell that listens to subl. Then select text, press a shortcut, and have it appear in the shell. This would be killer for ERPL. Easy to do in emacs and vim, even gedit. I think it’d be easy in subl too?

0 Likes

#8

I’d like to have the .bat file reside in the package directory. I’ve setup a sasswatch.bat in the root of my SASS package. It contains:

{ "cmd": "sasswatch.bat", "$file_path"], "selector": "source.sass" }

My sasswatch.bat contains

sass --watch %1:%1

I’m getting an error that it isn’t finding sasswatch.bat. How do I change the active directory to be the package’s directory so I can call that file?

0 Likes

#9

You should be able to add:

"working_dir": "$packages/Sass"
0 Likes

#10

That works Jon. Thanks for the info.

0 Likes