Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!news.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!cs.utexas.edu!convex!convex!arco!news.utdallas.edu!corpgate!nrtphaa9.nt.com!brtph560!n8pph28!ks
From: ks@n8pph28.nt.com (Kamlesh Shah)
Subject: Re: forkJob:arguments: problem
Message-ID: <1994Oct7.170527.7716@brtph560.bnr.ca>
Sender: ks@n8pph28 (Kamlesh Shah)
Date: Fri, 7 Oct 1994 17:05:27 GMT
References:  <Pine.A32.3.90.941006105217.17289H-100000@swim5.eng.sematech.org>
Organization: bnr
Lines: 39

In article <Pine.A32.3.90.941006105217.17289H-100000@swim5.eng.sematech.org>, "William D. Gooch" <goochb@swim5.eng.sematech.org> writes:
|> We are having a problem in VW 1.0 with UnixProcess class>>forkJob:arguments: 
|> which we aren't having much luck getting info about.  The problem is that 
|> when we do something like -
|> 
|> 	UnixProcess forkJob: program arguments: anArray.
|> 
|> nothing at all happens, even though the following -
|> 
|> 	UnixProcess cshOne: program , ' ' , (anArray at: 1)
|> 
|> works and has the expected behavior.  There is only one argument in 
|> anArray, which is a pathname string.  I have looked at this in the 
|> debugger quite a bit, including looking at the error handler created 
|> and passed on to primFork:..., but nothing shows up.  As far as I can 
|> tell, either no process gets created or it goes away too quickly to be
|> observed by normal means.  I'm not a Unix wizard.

We use forkJob in a few places. We had few problems too, mainly because the job being forked was a shell script, and that script forked something from it. If your forked Job is doing something like this, make sure the shell script forks it in the foreground only , i.e. without the '&' at the end.

The other weard thing is that when we do a forkJob, it is forked as the "user" who is logged in on the console of the system (at least on HP). I dont know in your situation if this difference means any thing.

If neither of the above makes any sense in your situation, I would try one of
the following things...
1) Write a little shell script/C program to write a few strings to a file, and
run it using forkJob, with having exactly one argument. This will tell you whether your job is really being forked or not.

2) Write a shell script hat writes something to stdout like "echo 'This is a test'", and then runs your "program" from it. In smalltalk, then I will do an inspect on the result of forkJob...


It may sound silly, but make sure that the result of forkJob, or the process instance itself is NOT getting GCed immediately. i.e., you must do something like...

(UnixProcess forJob: program arguments: Array with (..)) inspect.

or AGlobal := (UnixProcess forJob: program arguments: Array with (..)).
    AGlobal inspect.

Hope this helps...
-Kamlesh
