[Swift-devel] Assigning stdout to a string variable in Swift
Emalayan Vairavanathan
svemalayan at yahoo.com
Tue Apr 24 12:16:24 CDT 2012
Hi All,
Is it possible to assign a stdout to a string variable in Swift ?
I need to get the IP of a machine by executing an shell script and then assign it to a string variable. Please see the sample code pasted below (Here the string variable is written to a file to verify program works correctly). But the program didn't make any progress and swift was repeatedly printing a message called "Initializing site shared directory:1" on the console.
Any ideas ? Is this swift code is correct ? or swift does not support this feature ? In case if swift does not support this feature, is there a way to use the stdout without writing to a file ?
Thank you
Emalayan
1) Source code
type messagefile;
app (string machine) get_machine (string fileName) {
getIP fileName stdout = machine;
}
app (messagefile t) printIP (string m) {
echo m stdout=@filename(t);
}
string IP = get_machine("myFile")
messagefile outfile <simple_mapper;prefix="foo",suffix=".txt">;
outfile = printIP(IP);
2) Tc file:
localhost cat /bin/cat null null null
localhost echo /bin/echo null null null
localhost getIP /home/emalayan/Workspace/Mosa_March_12/tools/synthaticBenchmark/swift-scripts/pipeline-loc-aware/wrappers/getIP.sh null null null
3)Site file:
<config>
<pool handle="localhost">
<filesystem provider="local" />
<execution provider="local" />
<workdirectory>/home/emalayan/Mosa_March_12/tools/synthaticBenchmark/swift-scripts/pipeline-loc-aware/swift.work</workdirectory>
<profile namespace="karajan" key="jobThrottle">0</profile>
</pool>
</config>
4) stdout:
Swift 0.93 swift-r5483 cog-r3339
RunID: 20120424-0950-tkdyv925
Progress: time: Tue, 24 Apr 2012 09:50:45 -0700
Progress: time: Tue, 24 Apr 2012 09:51:15 -0700 Initializing site shared directory:1
Progress: time: Tue, 24 Apr 2012 09:51:45 -0700 Initializing site shared directory:1
Progress: time: Tue, 24 Apr 2012 09:52:15 -0700 Initializing site shared directory:1
Progress: time: Tue, 24 Apr 2012 09:52:45 -0700 Initializing site shared directory:1
Progress: time: Tue, 24 Apr 2012 09:53:15 -0700 Initializing site shared directory:1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20120424/c7fb0194/attachment.html>
More information about the Swift-devel
mailing list