Thank you Joey,

I think there should be an easy way of getting the error code, since
it seems to be a natural operation when executing a program from J,
but was disapointed to see (2!:2) doesn't work on J64, at least on
OpenSuSE 10.2. Has anybody tested (2!:2) on other configuration?

I have tested in j602 as you suggested but (2!:2) does not work either
and crashes J:
   9!:14''
j602/2008-03-03/16:45
   (2!:0)'ls -x'
icons  installer.txt  jbreak   jconsole     jee                    j.jar
jwd    libjnative.so  libj.so  profile.ijs  profilex_template.ijs

   (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):
0x00000000005feca0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x2abef80ea8fe]
/lib64/libc.so.6(cfree+0x76)[0x2abef80ebf36]
/lib64/libc.so.6(fclose+0x155)[0x2abef80dba65]
/home/vstar/j64-602/bin/libj.so(jthostio+0x1ba)[0x2abef85a600a]
/home/vstar/j64-602/bin/libj.so[0x2abef859268f]
...

Maybe there is a workaround to (2!:2) but I haven't found any, maybe
with direct OS function calls?

BTW, getting the error code on Windows can be done with the kernel32
GetExitCodeProcess function.


On Mon, Jul 21, 2008 at 12:09 PM, Joey K Tuttle <[EMAIL PROTECTED]> wrote:
> 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to