You should be able to do a simple test to see if 2!:0 waits, for example as
below. This does wait on my Mac with the same J as you, except the avx
version.

F=: jpath '~temp/t1.sh'
F fwrites~ '#!/bin/bash',LF,'sleep 2',LF,'echo "done"'
fmakex F

foo=: 3 : 0
echo 2!:0 F
echo 2+3
)

foo''

On Wed, Nov 22, 2017 at 7:28 PM, J. Patrick Harrington <[email protected]>
wrote:

> Bill,
>
>    I've tried that. ../synmod.exe < fort.5 > fort.6 in a terinal
> window works fine on all three machines. And the directory change
> is OK. WHen the program fails on the Mac Mini, the J session is
> left in the /home/tages/tlusty205/synspec/jph directory.
>
> Patrick
>
> On Thu, 23 Nov 2017, bill lam wrote:
>
>> You can try executing the cmd in bash shell to verify whether it actually
>> work on the other machine.
>>
>> Also check the cwd in J session to see it is correct.
>>
>> On Nov 23, 2017 12:54 AM, "J. Patrick Harrington" <[email protected]>
>> wrote:
>>
>> A>>    A problem has surfaced which has me puzzled. I have written a
>
> program which needs the results of another program, synmod.exe, which
>>> reads in a file, executes for a few seconds, and writes the results
>>> to the file fort.6 (synmod.exe is my modification of a 10,000 line
>>> fortran program). The relevant part of my program is as follows:
>>>
>>> LAM=: IX=: QX=: <''
>>> 1!:44 '/home/tages/tlusty205/synspec/jph'
>>> 'Ti gi lam1 lam2'=. y
>>> fix55 lam1, lam2    NB. put lam1 & lam2 into fort.55
>>> lngg=. 10^. gi
>>> nh=. -:#Ti
>>> i=. _1
>>> while. (i=. >:i)<nh do.
>>>   Tii=. i{Ti
>>>   lngi=. i{lngg
>>>   Kbicub Tii, lngi
>>>   2!:0 '../synmod.exe < fort.5 > fort.6'
>>>   Z=. lam2 CLEAN Extract''
>>>   'mu rad deg lam Flx Ia Qa pol'=. Z
>>>   LAM=: LAM, <lam
>>>   IX=: IX, <Ia
>>>   QX=: QX, <Qa
>>> end.
>>> 1!:44 '/home/tages/J6/SPIN.d'
>>>
>>> The issue here is the Foreign 2!:0. This code works *perfectly* on my
>>> Dell
>>> laptop running
>>>    JVERSION
>>> Engine: j806/j64/linux
>>> Release: commercial/2017-11-06T09:54:01
>>> Library: 8.06.09
>>> Qt IDE: 1.6.2/5.3.2
>>> Platform: Linux 64
>>> Installer: J806 install
>>> InstallPath: /home/tages/j64-806
>>>
>>> But... the very same code running on either of the other two machines I
>>> use fails. The line 2!:0 '../synmod.exe < fort.5 > fort.6'
>>> should write the results of synmod to the file fort.6, but
>>> instead defines fort.6 but writes nothing to it. Thus the
>>> Extract'' routine fails when it tries to read fort.6.
>>>
>>> I suspect that while 2!:0 waits for synmod.exe to finish, maybe
>>> on my other machines it transfers to the next line of the J code
>>> before fort.6 is written. One of these machines is a Mac Mini running
>>>    JVERSION
>>>    Engine: j806/j64nonavx/darwin
>>>    Release: commercial/2017-11-06T10:18:00
>>>    Library: 8.06.09
>>>    Qt IDE: 1.6.2s/5.6.3
>>>    Platform: Darwin 64
>>>    Installer: J806 install
>>>    InstallPath: /users/jph/j64-806
>>>
>>> So I'm asking if the foreign 2!:0 in some cases returns without
>>> waiting. I thought just 2!:1 did that.
>>>
>>> Apologies for the long-winded post,  Patrick
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to