On Wed, 09 Jul 2014, John Rose wrote: > I have this code: > Print "mplex", "-f 8", "-o " & "'" & sCombinedPath & "'", "'" & > sVideoPath & "'", "'" & sAudioPath & "'" > Exec ["mplex", "-f 8", "-o " & "'" & sCombinedPath & "'", "'" & > sVideoPath & "'", "'" & sAudioPath & "'"] To sOutput > I'm using the single quotes since they are required when entering the > equivalent commands in a Terminal e.g. mplex -f 8 -o > '/home/john/Videos/q.mpg' '/home/john/Videos/The Story of Science_ > Power, Proof____20140621_2000.m2v' '/home/john/Videos/The Story of > Science_ Power, Proof____20140621_2000.mp2'. > > The Print statement shows (at runtime): > mplex -f 8 -o '/home/john/Videos/q.mpg' '/home/john/Videos/The > Story of Science_ Power, Proof____20140621_2000.m2v' > '/home/john/Videos/The Story of Science_ Power, Proof____20140621_2000.mp2' > i.e. the exact equivalent of the working command when entered in a > Terminal. > > However, the Exec statement does nothing at runtime, though the > equivalent Terminal command works. There is no feedback on why by > Gambas. I've also tried the statements without the single quote usage & > it also did nothing. I'm fairly sure that this used to work on the > previous version of Gambas: I'm using kendek's Gambas3 ppa > (https://code.launchpad.net/~nemh/+archive/ubuntu/gambas3) which > installed Gambas 3.5.3. The code without the single quote usage is: > Print "mplex", "-f 8", "-o " & sCombinedPath, sVideoPath, sAudioPath > Exec ["mplex", "-f 8", "-o " sCombinedPath, sVideoPath, sAudioPath] > To sOutput > > The above sOutput variable has the value "". What I am doing wrong or is > it an issue in Gambas 3.5.3? >
The fundamental thing to remember is: Exec is way not the terminal/shell. The shell needs you to quote your arguments in different manners so that it can see where actual spaces are and where spaces belong to, e.g., file names. The space is a control sequence for the shell - not for Exec! In Exec, you must not quote stuff because the data you give is literally transferred into the kernel. If you write Exec ["program", "'file name'"], the kernel will look for a file literally named 'file name', the apostrophes being part of that file name! Just make sure that each argument is in its own array element; that is enough for Exec. This applies also to "-f 8" where you put two arguments into one array element. You'll confuse the program's command line parser because it does not know the switch "-f 8", it just knows the switch "-f" which may be followed by an argument "8", a *distinct* argument. To sum up, I'm pretty sure your Exec line should be like: Exec ["mplex", "-f", "8", "-o", sCombinedPath, sVideoPath, sAudioPath] Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user