Opened 7 years ago
Last modified 7 years ago
#17319 new defect
"VBoxManage guestcontroll run" stdin/out redirection not working
Reported by: | shangouet | Owned by: | |
---|---|---|---|
Component: | guest control | Version: | VirtualBox 5.1.30 |
Keywords: | guestcontroll run stdin stdout | Cc: | |
Guest type: | Windows | Host type: | Linux |
Description
I'm trying to run a python script inside a Windows 7-64bit virtual machine, redirecting stdin and stdout from/to Ubuntu 17.10 host.
GuestAdditions and python have been installed on the VM. I placed the python script on a shared directory.
The following commands never exits and does not echo anything until I pressed CTRL+C :
echo -1 | VBoxManage --nologo guestcontrol "w764 Clone" run --username Hector --password hectorH --exe "C:\Python27\python.exe" --wait-stdout -- E:\test.py
Here is the script "test.py":
print("Hello") while True: s = raw_input() a = int(s) print(a) if a < 0: break
I first tried to run it inside a windows terminal on the VM, and this works:
c:\> c:\python27\python.exe E:\test.py Hello -1 -1
To make sure the login parameters are ok, I run iexplore with success:
VBoxManage --nologo guestcontrol "w764 Clone" run username Hector --password hectorH --exe "C:\Program Files\Internet Explorer\iexplore.exe"
Change History (2)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Ok, first problem : I found in a comment of https://www.virtualbox.org/ticket/14506 that the first arg passed must be argv[0].
This makes my command line like this:
echo -1 | VBoxManage guestcontrol (...) --exe "C:\Python27\python.exe" --wait-stdout -- "python.exe" "E:\test.py"
This time a script with just a print command works, but as soon as I try to read from stdin, it remains stuck.
Edit : the first command given in the description should use db-quotes to pass arguments:
Anyway, the result is the same, but the first version should have raise an error : it seems the problem comes from argument passing. I'll investigate this.