OSError when run Alchemy as CMake custom_target
mani-monaj opened this issue · 4 comments
In order to build Parrot ARSDK as part of a larger project with CMake, I wrapped the build steps inside a CMake custom_target
. The issue is sometimes alchemy
fails due to the following error:
Traceback (most recent call last):
File "/home/travis/catkin_ws/devel/arsdk/build/alchemy/scripts/alchemake.py", line 289, in <module>
main()
File "/home/travis/catkin_ws/devel/arsdk/build/alchemy/scripts/alchemake.py", line 199, in main
jobCtrl = JobCtrl()
File "/home/travis/catkin_ws/devel/arsdk/build/alchemy/scripts/alchemake.py", line 134, in __init__
self.tcpgrp = os.tcgetpgrp(0)
OSError: [Errno 25] Inappropriate ioctl for device
The exception happens in the constructor of JobCtrl
class (os.tcgetpgrp
call)
self.tcpgrp = os.tcgetpgrp(0)
self.foreground = (self.tcpgrp == os.getpgrp())
I could not track down the root cause of the issue, however I think the following change should fix the problem:
try:
self.tcpgrp = os.tcgetpgrp(0)
self.foreground = (self.tcpgrp == os.getpgrp())
except OSError:
self.foreground = False
pass
It seems strange that this call failed but not the others (especially the one at the end line 255) when everything is put back.
Normally the check line 191 should verify that stdin is really a tty (so normally supporting the ioctl in question).
When the failure occurs, the invocation is done via a shell or an automated tools (I see travis in the path) that does not provide a 'real' tty for stdin ?
It seems strange that this call failed but not the others (especially the one at the end line 255) when everything is put back.
Normally the check line 191 should verify that stdin is really a tty (so normally supporting the ioctl in question).
I guess since the failure happens in the constructor first, it will never get a chance to show itself again given that no stdin
is available to this script.
When the failure occurs, the invocation is done via a shell or an automated tools (I see travis in the path) that does not provide a 'real' tty for stdin ?
It is being called from a meta build tool called catkin which itself wraps CMake: https://catkin-tools.readthedocs.org/en/latest/
For the first question I meant, with the patch that catch the exception in the constructor, does it work with other call to the same function ?
I'll take a look on catkin to see if there is something particuliar
For the first question I meant, with the patch that catch the exception in the constructor, does it work with other call to the same function ?
I see. I don't think so. Is there a way that I can force repo
to fetch/use a local copy of alchemy
? This way I can work on a patch.
I'll take a look on catkin to see if there is something particuliar
I can setup an environment that reproduces this bug with catkin
and give you full remote access. If that sounds good, please email me a public key and I will set that up.