Sublime Forum

Build system: "The handle is invalid"

#1

I created a build system for Lua, as follows:

{ "cmd": "lua", "$file"], "selector": "source.lua" }
When I attempt to build a file, the only output is:

[Error 6] The handle is invalid [Finished]
I’m attempting to use this on a restricted Windows computer at my school. The Lua executable is located in a temporary folder which is in my path (I’ve also tried with the absolute path). If I run the exact command that Sublime says it executes (in the console) from the command prompt, it works fine. The build system works fine on my Linux machine (I haven’t had a chance to test on my unrestricted Windows computer).

I’ve tried both 32 and 64 bit Lua binaries as well as different distributions, to no avail. Different executables - such as the python distribution that is provided on the computer - fail in the same way.

Is this a bug?

0 Likes

#2

I just started using Sublime Text 2 yesterday and am very impressed. It completely destroys most of the other tools I was using.

However I’ve been hitting this “The handle is invalid” error everywhere.
I’m running Vista. Sublime is running as my user, not an admin, but nothing is too restricted.

I’ve been able to make a little Python file to build .coffee files into .js and switch to them using subprocess.call with shell=True, so calling programs works. However whenever I try to redirect the standard output so I can play with it / see it in Sublime I get the error.

I’m a fairly experienced Python user but I have so far used it exclusively in Linux, so maybe this is a common pitfall in Windows and I just need to read the docs more carefully. However it seems to happen not just in my own Python script but in calls to Sublime functions I’d assume would be multiplatform.

Here are some of the ways I’ve recreated this so far:

  • When I add subprocess.PIPE to the subprocess calls with shell=true or false.
  • By running “view.window().run_command(‘exec’, {‘cmd’: ‘some-command’], ‘shell’:False} )”. Again, happens with shell being true or false.
  • Trying to use a build system as Delta describes above.

Its been awhile since his post was made. Has anyone out there figured this out?

0 Likes

#3

How do you start Sublime Text? Sounds like you’re starting it from the command line. If so, check this out:

0 Likes

#4

Thank you very much, launching Sublime Text outside of the command prompt gets rid of this problem.

I’ve tried setting PYTHONPATH to run from the prompt but that won’t fix it. My command prompt has so much goo in the environment variables I’m sure something else is tripping it up as well. :smile: For now I’ll just make a second batch file to launch Sublime with certain programs added to the path.

Thanks!

UPDATE: I found the issue and can now run it from my command prompt.

Here’s how my batch file used to look:

SET PYTHONPATH= 
START "Sublime Text 2" /B "C:\Program Files\Sublime Text 2\sublime_text.exe" %*

The /B option was messing it up for some reason. Normally I need that to keep the command prompt from waiting for the launched program to exit, but with Sublime its unnecessary for some reason. Taking the option off made it work.

0 Likes