Reputation: 54984
Is there a way to create a build command in Sublime Text that opens a new external window (terminal/cmd.exe)? Everything I try gets captured to the built-in output window.
I tried:
{
"cmd": ["ruby", "$file"],
"target": "cmd.exe",
"file_regex": "rb$",
"selector": "source.rb"
}
But nothing happened
Upvotes: 3
Views: 2024
Reputation: 3305
May be you will find this solution helpful: https://github.com/rctay/sublime-text-2-buildview
(transfers build output in the separate sublime tab, you can then do with it whatever you want)
Upvotes: 1
Reputation: 102852
The following works for Windows (I've tested it on XP and 7):
{
"cmd": ["start", "cmd", "/k", "c:/ruby193/ruby.exe", "$file"],
"selector": "source.ruby",
"shell": true,
"working_dir": "$file_dir"
}
Save it as Packages/User/Ruby_cmd.sublime-build
(you may need to alter the path to the Ruby executable depending on your system), select Tools -> Build System -> Ruby_cmd
, and build with CtrlB.
start
does what it says it does, start a new process independent of Sublime Text. cmd
is cmd.exe
, the Windows command-line interpreter. The /k
flag keeps the window open (at a new command prompt) after your program has run, allowing you to examine its output, look at tracebacks, run additional commands, etc.
Upvotes: 2