Closed XZHENDONG closed 1 year ago
Thanks for submitting this report! Can you maybe set a breakpoint within the GuestSession.execute()
function and see where it's getting hung up?
Thanks for your help!
It stops at the e = bytes(process.read(2, 65000, 0)) of the read_out() method, and keep going, I will finally trace to the site-packages\win32com\client__init__.py.It stops at DispatchBaseClass.ApplyTypes() to call self.oleobj.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args).
C:\Python27\Lib\site-packages\win32com\client\__init__.py
class DispatchBaseClass:
...
def _ApplyTypes_(self, dispid, wFlags, retType, argTypes, user, resultCLSID, *args):
return self._get_good_object_(
self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args), ### stop here!!!
user, resultCLSID)
...
Can you try execute(..., flags=[virtualbox.library.ProcessCreateFlag.wait_for_std_out, virtualbox.library.ProcessCreateFlag.ignore_orphaned_processes])
?
Might be waiting for stderr that will never write anything?
I think I ran into this issue a while ago and ended up writing my own execute()
function. I'll see if I can find the code...
Looks like I can't find it. I would try looking at the ProcessCreateFlag.wait_for_process_start_only
and try running that process asynchronously.
I've tried not to use ProcessCreateFlag.wait_for_std_err.it would stop at o = bytes(process.read(1, 65000, 0)).Looks like the same problem.It seems that I can only try to use the vboxapi directly.Thanks
Does anyone has any fix for this? I am currently facing the same issue: I try to launch the terminal on Ubuntu via execute, however my code is also hanging in the gs.execute()
.
I'll have to look into this issue, there are currently no fixes available. The best way to handle it would probably be replicating the code within GuestSession.execute()
with specific flags and behaviors for your use-case.
Yes I finally managed to get it working with the normal execute
function when playing with the flags!
I no longer have time to maintain this library, so am closing this issue.
ENVIRONMENT
master
branch?SUMMARY
I want to run the command on my centos7 guest os and get the stdout. the command would execute on guest os but did not return.Like gs.execute('/bin/ls',['/home']),my script would block here.
And I tried to run gs.execute('/usr/bin/mkdir', ['/tmp/test']) ,the directory create success but it also no return.
other functions like makedirs() in IGuestSession are same.
STEPS TO REPRODUCE
EXPECTED RESULTS
print stdout.
ACTUAL RESULTS
it block on the execute() function and do not have any return.