One Star

Will tSystem function with spaces?

I'm trying to use tSystem in TOS 3.1.3 within a java project running on Linux in order to call a command line utility from VMWare:
tSystem Component Command:
"/usr/bin/vmrun -T server -h https://serverSmiley Tongueort/sdk -u username -p password -gu guestuser -gp guestpassword runProgramInGuest \" Virtual/virtual_file.vmx\" -activeWindow -interactive \"c:\\program files\\path\\program.exe\" /switch"
The issue seems to be with the spaces within the quoted paths, starting with the one after \"
Even though the double quotes are escaped, the tSystem command is broken at each space within the quoted string, just as though there were no quotes.
This same command runs perfectly in a Perl project using double quotes without the escape.
How might I deal with spaces properly? I thought that enclosing them in escaped double quotes would be sufficient.
On run, the jobs errors with:
Error: Cannot open VM: ", unknown file suffix
which seems to indicate that the command is being split on the space.
3 REPLIES
Six Stars

Re: Will tSystem function with spaces?

I think the quickest route is to create a custom shell script that launch the commands you want and then call the script from tsystem ( the advange is that you don't need to change the talend job if you need to change the script ).
tsystem in java uses api Runtime.exec that does split the argument string using spaces...
bye
One Star

Re: Will tSystem function with spaces?

Thanks. That's unfortunate.
One Star

Re: Will tSystem function with spaces?

Better fix implemented here in case anyone else comes across this issue again:
https://help.talend.com/search/all?query=Executing+a+command+with+spaces+using+a+tSystem+component&c...