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.
[EMAIL PROTECTED] tim]$ ls *.cpp
ls: *.cpp: No such file or directory
[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to