Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Problems with 'call

From: tim-johnsons::web::com at: 19-Apr-2006 17:19

I'm picking up this topic again: there are features to 'call on linux that are downright baffling, and if I were to use it in an application, rather strange to me. Let's look at some examples:
>> res: call "ls *.r"
user.r ;; okay == 0 ;; exit code of 0 is correct ;; now let's introduce a legitimate call that has unsuccessful results res: call "ls *.cpp" ls: *.cpp: No such file or directory == 0 ;; hmmm! now let's do the same from the shell. [tim-linus tim]$ ls *.cpp ls: *.cpp: No such file or directory [tim-linus tim]$ echo $? 1 ;; NOTE the differences in the exit code. Now let's 'buffer' the output
>> buffer: copy ""
== "" res: call/output "ls *.r" buffer == 214 ;; say what?
>> buffer
== "user.r^/" ;; good ;; now the following is definitely unsettling, because it disables the ;; programmer's ability to gracefully handle errors:
>> clear buffer
== ""
>> res: call/output "ls *.cpp" buffer
;; Hoy moly, prints to stdout ls: *.cpp: No such file or directory == 214 ;; again exit code is inconsistant with shell command
>> buffer
== "" ;; and nothing in the buffer ;; Trying another refinement res: call/error "ls *.cpp" buffer == 214
>> buffer
== "ls: *.cpp: No such file or directory^/" ;; now that's a bit better, at least we've captured the error message. ;; but I'm still baffled about the anomalies in the exit codes. ;; BTW: using the /info refinement returns the same exit code as ;; an attribute Just curious. Does anyone think that this should be treated as a bug? Otherwise, I could wrap this in a function that could handle some of these inconsistancies. tim -- Tim Johnson <>