The "interface error" is a problem for me, so for years I have wrapped 2!:0 as:

  host =: [: 2!:0 '(' , ' || true)' ,~ ]

You can probably tinker that to return the error too, but having the stderror output doesn't usually cause me a problem, and can be helpful in casual use.

Your problem with 2!:0 is a bug, likely somewhere in 64 bit support - e.g. Maybe you should try an update to j602a.

   (2!:2) 'ls -x'
31228 _1605202516 _1605202428

   1!:20 ''
+-----------+------+
|_1605202516|<ls -x|
+-----------+------+
|_1605202428|>ls -x|
+-----------+------+

   version ''
Installer: j602a_mac_powerpc.dmg
Engine: j602/2008-03-03/16:45
Library: 6.02.023ProductName:   Mac OS X
ProductVersion: 10.5.4


   (2!:2) 'ls -x'
16956 161758064 161758424

   1!:20 ''
+---------+------+
|161758064|<ls -x|
+---------+------+
|161758424|>ls -x|
+---------+------+

   version ''
sh: sw_vers: command not found
Installer: j602a_linux32.sh
Engine: j602/2008-03-03/16:45


At 22:54  -0500 2008/07/20, Jorge Arredondo wrote:
I'm using (2!:0) on Linux to execute a process, if it exits with code
0, I can obtain its output and continue, otherwise an interface error
exception is signaled. Is it possible to execute a process from J on
Linux and get its status code? I tried using (2!:2) but it doesn't
work as it abnormally ends J.

I'm using OpenSuse Linux 10.2 x64 kernel 2.6.18.8-0.9-default (no
mods) and J 6.01

Example:
   (2!:0) 'ls -x'
addons       breaker.ijs  install.txt  jbreak  jconsole    jee
jep          jicon.gif    j.jar        jw      libj601.so  libjnative.so
libjpcre.so  profile.ijs  system       temp    user        version_bin.txt

   (2!:0) 'ls -'
ls: cannot access -: No such file or directory
|interface error
|       (2!:0)'ls -'
   (2!:2) 'ls -x'
*** glibc detected *** ./jconsole: double free or corruption (!prev):
0x00000000008daf90 ***
======= Backtrace: =========
/lib64/libc.so.6[0x2b9b98c268fe]
/lib64/libc.so.6(cfree+0x76)[0x2b9b98c27f36]
/lib64/libc.so.6(fclose+0x155)[0x2b9b98c17a65]
...
----------------------------------------------------------------------
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