Sublime Forum

Build Systems And Opening Output

#1

Hi, Guys. I wonder if anyone can help me find a neat solution to a problem.

I’m writing a command-line tool that takes a source file as a parameter, and writes XML to the console;

> myexe.exe "c:\input.xml"
<xml>
  <!-- output here -->
</xml>

What I’d like to do is write a .sublime-build file which runs my command-line tool with the name of the current open file, and capture all the console output to a new unsaved buffer. Anyone know if this is possible?

I’ve tried directing the output to a file, but a build script like the following fails;

build "myexe.exe" "C:\input.xml" "$File" ">" "c:\temp\out.xml"

Sublime X: Jon, Is this the sort of thing you could do more easily with the new buffer system in Sublime X?

0 Likes

#2

I’d think the best way to do this is to ignore the .sublime-build file, and use Python’s subprocess module directly. You can then append the output to a new buffer yourself (window.newFile() returns the created view, which should make this part of the process fairly simple).

0 Likes