when using gogo gosh scripts, how do I get print outs from all commands

407 views Asked by At

I'm trying to automate the provisioning and searching of a service to speed up testing of changes to an OSGi system. I use Maven Pax:Provision to set up the environment from the various repositories.

I have some commands to load data from xml files and then some commands to search the services. The search commands all return a string describing the results.

I've a provision.tsl file with the commands to load the osgi environment and a search.tsl file that runs the search commands. In the search.tsl I have a list of search command, each for the various tables I've loaded. E.G.

echo Doing some searching
searchcell someTable someValue searchColumnName
echo search someOtherTable
searchcell someOtherTable someOtherValue searchColumnName
echo search yetAnotherTable
searchcell yetAnotherTable yetSomeOtherValue searchColumnName

However, when I run the search command E.G.

osgi> gosh search.tsl 

I only get the result from the last command in the file. Echo works as normal though and looks like.

Doing some searching
search someOtherTable
search yetAnotherTAble
return results from searchCell yetAnotherTAble

Is this the expected behaviour for gosh?

1

There are 1 answers

0
Derek Baum On

The gosh console automatically prints the value of each interactive command.

This makes it appear that your searchcell command is printing a result, when in fact it is returning a String, which gogo prints.

This doesn't work in scripts, so you either need to recode your searchcell command to print to stdout, or explicitly print each result in your script:

echo Doing some searching echo (searchcell someTable someValue searchColumnName) echo search someOtherTable echo (searchcell someOtherTable someOtherValue searchColumnName)