Sublime Forum

Build without terminal window

#1

Hi,

I currently build .sh script than runs something in Terminal.app when I press cmd+R.

However every time I do that, Sublime Text’s own terminal also opens. Is there a way to run a Build command without the terminal window poping up?

Thank you.

0 Likes

#2

Hi~

I’m a newbie of SublimeText

Currently, I’m not using the Build system.

Instead of the build system, the Plugin can be alternative for that.

Below is my script for executing Python Script.

import os
import subprocess

class runpyscriptCommand(sublime_plugin.TextCommand):
	def run(self, edit):

		# Enable Python Console
		sublime.active_window().run_command("show_panel", {"panel": "console", "toggle": True})

		filepath = self.view.file_name()
		strCmd = 'cmd /c "c:\\python27\\python.exe "%s"' % filepath
		os.chdir('d:\\tmp')

		print '*] Python Script Executed.'
		print '------------------------------------------------------------------------------------'
		hash_pipe = subprocess.Popen(strCmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
		hash = hash_pipe.stdout.read()
		error = hash_pipe.stderr.read()
		
		if hash != '':
			print hash

		if error != '':
			print '[ERROR] Check your Script !!'
			print error

If someone know any good way to that, please tell me :smile:

Thanks.

0 Likes