KangoExtensions / kango

Kango framework issue tracker
74 stars 7 forks source link

Subprocess piping problem with framework 1.2 when executing automated build #46

Closed smartvault-abbott closed 11 years ago

smartvault-abbott commented 11 years ago

We build under CruiseControl.NET using a standard build task and are having an issue where the Kango build is failing.

File "C:\Builds\browser-plugin-next\3rdparty\kango-1.2.0.0\kango\commands\build.py", line 112, in _build_extension
builder.pack(out_path, extension_out_path, os.path.join(project_src_path, key))
File "C:\Builds\browser-plugin-next\3rdparty\kango-1.2.0.0\kango\builders\chrome.py", line 219, in pack
subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.read()
File "C:\Python27\lib\subprocess.py", line 672, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Python27\lib\subprocess.py", line 777, in _get_handles
p2cread = _subprocess.GetStdHandle(_subprocess.STD_INPUT_HANDLE)
WindowsError: [Error 6] The handle is invalid
make: *** [kango-build] Error 1

Our build process is the same as it has been for 1.0 (and prior), but it looks like something has changed with 1.2 that is causing a problem.

Is there a patch for this?

akrylysov commented 11 years ago

What is your OS version, Chrome version, Chrome install directory?

smartvault-abbott commented 11 years ago

OS is Windows 7 Professional. Chrome is 27.0.1453.93. Chrome is installed in "C:\Program Files (x86)\Google\Chrome".

This really looks like an issue with where the Python subprocess module is trying to do something aggressive with the STDIN/STDOUT pipes and is not getting the behavior it expects.

Building the project manually works fine. The problem only occurs when building in our production build environment (CruiseControl.NET).

As mentioned; this works with framework 1.0 and prior.

akrylysov commented 11 years ago

Please try to replace http://extensions.desktopaddons.com/misc/chrome.py in kango-1.2.0.0\kango\builders directory.

smartvault-abbott commented 11 years ago

It did not work...

File "C:\Builds\jda-kango-pipe-fix\3rdparty\kango-1.2.0.0\kango\commands\build.py", line 112, in _build_extension
builder.pack(out_path, extension_out_path, os.path.join(project_src_path, key))
File "C:\Builds\jda-kango-pipe-fix\3rdparty\kango-1.2.0.0\kango\builders\chrome.py", line 219, in pack
subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
File "C:\Python27\lib\subprocess.py", line 672, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Python27\lib\subprocess.py", line 777, in _get_handles
p2cread = _subprocess.GetStdHandle(_subprocess.STD_INPUT_HANDLE)
WindowsError: [Error 6] The handle is invalid
make: *** [kango-build] Error 1

However! Starting from this new version, I tweaked the subprcess.Popen calls as suggested in the following thread...

http://stackoverflow.com/questions/10290990/subprocess-popen-not-working-with-pythonw-exe

and that seems to have fixed the problem. Basically: setting "stdin=subprocess.PIPE" in each of the subprocess.Popen calls.

akrylysov commented 11 years ago

Thank you for the solution! we will try this fix shortly.

smartvault-abbott commented 11 years ago

Do you have a timeline for when the official fix for this will be made available?

akrylysov commented 11 years ago

I hope we will be able to release the new Kango version at the beginning of the next week (it also will includes AMO fixes).