Home Download Buy Blog Forum Support

Build system: "The handle is invalid"

Build system: "The handle is invalid"

Postby Delta on Fri Jun 03, 2011 8:50 pm

I created a build system for Lua, as follows:
Code: Select all
   "cmd": ["lua", "$file"],
   "selector": "source.lua"

When I attempt to build a file, the only output is:
Code: Select all
[Error 6] The handle is invalid

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?
Posts: 1
Joined: Fri Jun 03, 2011 8:06 pm

Re: Build system: "The handle is invalid"

Postby showka on Sun Oct 02, 2011 2:43 pm

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?
Posts: 2
Joined: Sun Oct 02, 2011 2:32 pm

Re: Build system: "The handle is invalid"

Postby guillermooo on Sun Oct 02, 2011 5:09 pm

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

Posts: 738
Joined: Thu Jul 23, 2009 9:06 am

Re: Build system: "The handle is invalid"

Postby showka on Sun Oct 02, 2011 7:34 pm

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. :) For now I'll just make a second batch file to launch Sublime with certain programs added to the path.


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

Here's how my batch file used to look:
Code: Select all
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.
Posts: 2
Joined: Sun Oct 02, 2011 2:32 pm

Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 33 guests