f



how to spawn and expect multiple processes "in parallel"

Hello,

I have a script foobar.tcl on WinXP that uses Expect to spawn a
process, interact with it, and log everything using log_file

Now I need to extend it, so that it spawns 2 processes, and does the
same interaction with both (and logs each to its own log file).  This
has to be done as if "in parallel" (I write in quotes because with 1
processor it is not strictly speaking possible).

I thought I would just do something like

exec [tclsh foobar.tcl 0]
exec [tclsh foobar.tcl 1]

but it seems I am not returning from the first call when I do it
interactively at tclsh prompt.  So I think I must be confused here.
Please tell me the "proper" way to do this.

Mark
0
9/3/2009 11:33:52 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

2 Replies
795 Views

Similar Articles

[PageSpeed] 47

> Please tell me the "proper" way to do this.
>
> Mark

Oh I forgot, I just append &
>exec tclsh foobar.tcl 0 &
>exec tclsh foobar.tcl 1 &

I think this is the best way?
0
9/3/2009 11:59:24 PM
Mark_Galeck wrote:
>> Please tell me the "proper" way to do this.
>>
>> Mark
> 
> Oh I forgot, I just append &
>> exec tclsh foobar.tcl 0 &
>> exec tclsh foobar.tcl 1 &
> 
> I think this is the best way?

Yes. If the processes don't need to communicate with each other, then 
this is by far the simplest approach.

-- Neil
0
nem3909 (1000)
9/4/2009 4:30:07 PM
Reply:

Similar Artilces:

"""""""""ADD ME""""""""""
Hi , Hope you are doing great. Please let me take this opportunity to introduce myself, Iam Karthik working with BhanInfoi Inc, a NY based company. We have consultants on our bench on various technologies, my request is to add me to your distribution list and kindly do send me the requirements. i have the below list available 1. Mainframe 2. Java 3.. Financial Analyst 4. Data Architect If there is any vendor ship agreement which has to be signed then I would like to take an opportunity to represent my company and expect your cooperation... ...

Expect on windows
Hi all, I'm trying to learn expect with a few experiments.. I'm on Expect 5.43 + Tcl 8.5.7.0 on windows. I have an hello.exe file compiled from the following C++ source: #include <iostream> int main(int argc, char *argv[]) { char msg[100]; std::cout << "Hello" << std::endl; std::cin >> msg; std::cout << "You said " << msg << std::endl; return 0; } The following expect script works correctly: package require Expect console show set exp::winnt_debug 1 exp_log_user 0 exp_spawn hello expect { "Hello" { puts "Got hello there!" exp_send "Hi\r" exp_continue } "You said Hi" { puts "Worked ok" exp_exit } timeout {puts "Timed out"} } I'm now trying to do the following: a. Start a shell. b. Invoke hello.exe in that shell. c. Match the output of hello.exe. So I modified the script to: package require Expect console show set exp::winnt_debug 1 exp_log_user 0 # Changed the following two lines exp_spawn cmd.exe exp_send "hello\r" expect { "Hello" { puts "Got hello there!" exp_send "Hi\r" exp_continue } "You said Hi" { puts "Worked ok" exp_exit } timeout {puts "Timed out"} } I get time out error now, probably because expect is trying to match the output of cmd.exe, but it need...

why "::", not "."
Why does the method of modules use a dot, and the constants a double colon? e.g. Math::PI and Math.cos -- Posted via http://www.ruby-forum.com/. On Oct 26, 2010, at 01:48 , Oleg Igor wrote: > Why does the method of modules use a dot, and the constants a double > colon? > e.g. > Math::PI and Math.cos For the same reason why inner-classes/modules use double colon, because = they're constants and that's how you look up via constant namespace. Math::PI and ActiveRecord::Base are the same type of lookup... it is = just that Base is a module and PI is a float....

"out" and "in out"
Hi i found the following explaination: In Ada, "in" parameters are similar to C++ const parameters. They are effectively read-only within the scope of the called subprogram. Ada "in out" parameters have a reliable initial value (that passed in from the calling subprogram) and may be modified within the scope of the called procedure. Ada "out" parameters have no reliable initial value, but are expected to be assigned a value within the called procedure. What does "have no reliable initial value" mean when considering the "out" parameter? By c...

"/a" is not "/a" ?
Hi everybody, while testing a module today I stumbled on something that I can work around but I don't quite understand. >>> a = "a" >>> b = "a" >>> a == b True >>> a is b True >>> c = "/a" >>> d = "/a" >>> c == d True # all good so far >>> c is d False # eeeeek! Why c and d point to two different objects with an identical string content rather than the same object? Manu Emanuele D'Arrigo wrote: >>>> c = "/a" >>>&...

about "++" and "--"
why this program snippet display "8,7,7,8,-7,-8" the program is: main() { int i=8; printf("%d\n%d\n%d\n%d\n%d\n%d\n",++i,--i,i++,i--,-i++,-i--); } > why this program snippet display "8,7,7,8,-7,-8" Ask your compiler-vendor because this result is IMHO implementation-defined. Check this out: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.15 http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.16 Regards, Irina Marudina fxc123@gmail.com wrote: > why this program snippet display "8,7,7,8,-7,-8&q...

"my" and "our"
Hi, while testing a program, I erroneously declared the same variable twice within a block, the first time with "my", the second time with "our": { my $fz = 'VTX_Link'; .... ( around 200 lines of code, all in the same block) our $fz = 'VTX_Linkset'; ... } So the initial contents of the $fz declared with "my" is lost, because "our" creates a lexical alias for the global $fz, thus overwriting the previous "my" declaration. It was my error, no question. But I wonder why Perl doesn't mention this - even with "use s...

"or" and "and"
Hi, I'm just getting to discover ruby, but I find it very nice programming language. I just still don't understand how the "or" and "and" in ruby... I was playing with ruby and for example made a def to print Stem and Leaf plot (for those who didn't have a statistics course or slept on it, e.g. http://cnx.org/content/m10157/latest/) Here is the Beta version of it: class Array def n ; self.size ; end def stem_and_leaf(st = 1) # if st != (2 or 5 or 10) then ; st = 1 ; end k = Hash.new(0) self.each {|x| k[x.to_f] += 1 } k = k.sort{|a, b| a[0].to_f <=&g...

Problem with "Expect" ? "Telnet"? "TclApp"?
Hi, My script try to "Telnet" a machine with "Expect", and it is wrapped to EXE extension with "TclApp". DEP is turned off, and file dgbhelp.dll exists. And now, I run the script. It works well in some PC. However in others, it turns out that the commands in "Telnet" is not executed. I capture the packets, and find that the "username" is not promoted when the server ask for it. Then I try the tcl extension script, it is OK in every PC. I have no idea what's going on.It is the problem of "Expect", "Telnet", or "TclApp", or the OS of my PCs? zhoujingyu Regards, The problem troubles me so much. I am crying for you help. Can anyone give me some advice? Thank you very much! Regards, zhoujingyu At 2008-04-23 08:51PM, "1985zhoujingyu@163.com" wrote: > The problem troubles me so much. I am crying for you help. Can anyone > give me some advice? Thank you very much! Show us your Expect script. -- Glenn Jackman "If there is anything the nonconformist hates worse than a conformist, it's another nonconformist who doesn't conform to the prevailing standard of nonconformity." -- Bill Vaughan On 4=D4=C224=C8=D5, =CF=C2=CE=E79=CA=B124=B7=D6, Glenn Jackman <gle...@ncf.c= a> wrote: > > Show us your Expect script. > > -- > Glenn Jackman > "If there is anything the nonconformist hates worse than a conformist, > it'...

Does it need a ";" at the very after of "if" and "for"
write code like: int main(void) { int a=10; if(a<20) {} } Compiler ok on dev-cpp . don't we have to add a ";" after if statement? marsarden said: > write code like: > > int main(void) > { > int a=10; > if(a<20) > {} > } > > Compiler ok on dev-cpp . don't we have to add a ";" after if > statement? The syntax for 'if' is: if(expression) statement There is no semicolon after the ) but before the statement. The statement is either a normal statement (which can be empty), ending in a semicolon:- if(expr) ...

"In" "Out" and "Trash"
I just bought a new computer and I re-installed Eudora Light on my new computer. But when I open Eudora, the "In", "Out" and "Trash" links are not on the left side of the screen the way they were on my old computer. How can I get these links back on the left side of the screen? Thank you. On 25 Mar 2007 09:49:22 -0700, "abx" <abfunex@yahoo.com> wrote: >I just bought a new computer and I re-installed Eudora Light on my new >computer. But when I open Eudora, the "In", "Out" and "Trash" links >are ...

Looking for binary "expect" and "TCL/Tk" (if required) for OpenServer6
Does anybody know where to find "expect" (and related requirements) for OpenServer6? I can download the source files from nist.gov, but they do not compile. The MAN pages are already loaded on the system, so I suspect the programs would be on the distribution media somewhere. Any help would be appreciated. Thanks, Rick On 9 Feb, 17:57, Rick_Hoyle <motosl...@hotmail.com> wrote: > Does anybody know where to find "expect" (and related requirements) > for OpenServer6? I can download the source files from nist.gov, but > they do not compile. The MAN pages are al...

when to use "conv2", when to use "fft"->"multiplication"->"ifft"?
Hi all, I am doing 2D image filtering with sometimes filter size larger than image size. I am wondering which of the following scheme is the fastest, using Matlab: 1) conv2, 2D convolution directly; 2) conv2, but decompose the filter into two separable filters and then conv2 will first convolve along X axis and then convolve along Y axis; 3) fft2, multiplication, ifft2, all in 2D domain; 4) fft, multiplication, ifft, all in 1D case and work on convolutions of separable filters along X axis and Y axis; (similar to 2, but do 1D convolution all in frequency domain). Images and filters are...

Gary Sokolich """"""
"""""""""" http://www.manta.com/c/mmlq5dm/w-gary-sokolich W Gary Sokolich 801 Kings Road Newport Beach, CA 92663-5715 (949) 650-5379 http://www.tbpe.state.tx.us/da/da022808.htm TEXAS BOARD OF PROFESSIONAL ENGINEERS February 28, 2008 Board Meeting Disciplinary Actions W. Gary Sokolich , Newport Beach, California �V File B-29812 - It was alleged that Dr. Sokolich unlawfully offered or attempted to practice engineering in Texas (...) Dr. Sokolich chose to end the proceedings by signing a Consent Order that was accepted by ...

Question about "sprintf" "@" "do for"
Hello, this works: A1=3D1 A2=3D2 A3=3D3 i=3D1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari do for [i=3D1:3]{ vari=3Dsprintf("A%.f",i) print vari } But I want to have "print vari,"=3D",@vari" in the loop. But it dosen't=20 work. Why can't I use "print vari,"=3D",@vari" in the loop? Is there a=20 solution for? J=C3=B6rg Jörg ...

puts "\\".gsub("\\", "\\\\")
Hello, I have a mini-ruby quiz. Guess what this line of code writes to the console, then try it for yourself: puts "\\".gsub("\\", "\\\\") Why is that so? Martin From: martinus [mailto:martin.ankerl@gmail.com]=20 # Hello, I have a mini-ruby quiz. Guess what this line of code writes to # the console, then try it for yourself: # puts "\\".gsub("\\", "\\\\") puts "\\".gsub("\\", "\\\\") \ #=3D> nil # Why is that so? faq. escaping the escape in sub/gsub. search the archives. maybe you want somethin...

why have both "." and "->" ?
I used to remember why c++ needed both ? Could somebody help me here ? For example class A{ f(); }; A* aa; You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. Raj "raj" <rajkumar@hotmail.com> schreef in bericht news:d7fee6d0.0406230748.694b966b@posting.google.com... > I used to remember why c++ needed both ? > Could somebody help me here ? > > For example > > class A{ > f(); > }; > > A* aa; > > You could do either "aa->f()" or "(*aa).f()". So why does C++...

how to change "/" to "\"
iam new to shell scripting and i have plz can anyone help in changing the pattrern "/" to "\" using the sed command. olympie@gmail.com wrote: > iam new to shell scripting and i have plz can anyone help in changing > the pattrern "/" to "\" using the sed command. sed 's/\//\\/g' will replace all '/' with '\' srp -- http://saju.net.in Saju Pillai <saju.pillai@gmail.com> wrote: >> iam new to shell scripting and i have plz can anyone help in changing >> the pattrern "/" to "\" using ...

"A" is not equal "A"?
I was trying to convert String Array to String A through cycle and than compare the result with String B but eventhough results were the same it returned false. I'am working in BlueJ 3.1.0 Code is: public boolean Method () { String[] Example = {"a","b","c"}; String A = ""; String B = "abc" for (int i = 0; i<3 ; i++) { A = A + Example[i]; } if (A == B) { return true; } } never got true... I appreciate any suggestions how to solve this Den 08.04.2014 10:06, skrev 245dav@gmail.com:...

why "expect" skip the "send" command?
Hi I write my expect in a bash shell script. I just want the expect could send different commands after receiving different messages. I don't know why this script don't work. #!/bin/sh expect -c 'send "Is it ok?'\r" expect { "OK" {send "Thanks\r";system date;send "Thanks again \r"} "NO" {send "Are you sure?\r";system ls;send "Can you check it again?\r"} }' If the program return "OK",the expect could do system command "date" ,but I found it never do the send command "Thanks" and "Thanks again". And if the program return "NO",the expect could do system command "ls",but skip the send command "Are you sure?" and "Can you check it again?" too!!! I don't know why the expect just skip the "send" command with no error but do the system command "ls" and "date" smoothly. Could you give any suggestions? Thank you very much and sorry for my poor english. $B5H5H(B wrote: > Hi > I write my expect in a bash shell script. I would write my expect scripts into a file, YMMV > I just want the expect could send different commands after receiving > different messages. > > I don't know why this script don't work. To make this gastly thing work a tiny bit get rid o the |'| inside the initial sen...

How to change "/" to "\"
Now, the output as below /a/b/c.txt b/c.txt x:/b/c.txt , Need to change x:\b\c.txt #!/bin/ksh # echo.ksh a=/a/b/c.txt echo $a echo ${a#/*/} y=`echo x:/${a#/*/} | tr -s '/' '\'` echo $y moon wrote: > Now, the output as below > > /a/b/c.txt > b/c.txt > x:/b/c.txt , Need to change x:\b\c.txt > > > #!/bin/ksh > # echo.ksh > a=/a/b/c.txt > echo $a > echo ${a#/*/} > y=`echo x:/${a#/*/} | tr -s '/' '\'` > echo $y > > One escape necessary: echo x:/${a#/*/} | tr -s '/' '\\' Two escapes necessar...

Any difference between "send_user" and "puts" in Expect?
According to expect(1) manual "send_user" seems to do the same thing as Tcl's "puts" but what is "send_user" invented for? At 2012-12-11 10:37AM, "Clark WANG" wrote: > According to expect(1) manual "send_user" seems to do the same thing > as Tcl's "puts" but what is "send_user" invented for? The main difference is that puts automatically appends a newline and send_user does not. In this regard, "puts -nonewline" is more analagous to send_user. send_user also "inherits" some options from expect's "send", such as -s and -h (check the expect man page for details). See http://99-bottles-of-beer.net/language-expect-249.html for a usage of the -h flag. -- Glenn Jackman Write a wise saying and your name will live forever. -- Anonymous ...

Error: "identifier" expected, "(" found.
I am trying to do an integration for the value of gradPE which has the following equation: gradPE = Gamma*pi*2*Gy(p-2) So I wrote the below code: For p = Mcount+1:N1 M(:,p) = A*M(:,p-1)+B; F = @(Gy)(Gamma*pi*2*Gy(p-2)); gradPE = quad(F, 0, 300); % 0 and 300 are my limits end; Where Gamma = 4256; Mcount = 1; N1 = 1020; %Gy= are values located in an excel sheet {up to 1020 values for Gy}. I even tried to add another anonymous function to F: F = F = @(p) (quad(@(Gy) (Gamma * p...

"static" prefix
I've been playing with the Checkstyle "Require this" check. http://checkstyle.sourceforge.net/config_coding.html#RequireThis This forces you to distinguish between local variables, instance variables and static variables in you code - buy using "this.var" for all instance variables and "Classname.var" for all static variables. It (optionally) does the same for all method calls. Essentially, I like the effect - but it highlights the need for a static prefix in Java to match the "this" prefix. Just as "this." refers to the instance, the ...

Web resources about - how to spawn and expect multiple processes "in parallel" - comp.lang.tcl

Resources last updated: 3/13/2016 11:21:56 AM