This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Date: Fri, 5 Dec 1997 09:35:00 -0800 | From: Anthony Green <green@cygnus.com> | The same thing is happening in your first example, except that guile | isn't decoding the result for you. If you were to call system() from | C, then you would use the WEXITSTATUS macro to decode the result. On | your machine, this would shift the result to the right by 8 bits. | 65280 >> 8 == 255. You need to do this yourself in | Guile. Unfortunately, this isn't portable. It's like the value returned from waitpid, so you can use: (status:exit-val 65280) 255 The status:exit-val technique comes from scsh. | | As long as Guile is providing 'system', it should provide some support | for extracting the results properly. Hmmm.. now that I think about it, | 'system' isn't very schemey, is it? I think we should trash it in | favour of something that actually returns a decoded exit code, and | does some kind of appropriate throw otherwise. It's not very schemey to punt to /bin/sh (system can run pipelines etc., only under unix I guess). I wanted to dump system and open-pipe at one time. But since they are the only convenient methods available in guile-core, it seems worth keeping them around. I guess I'll add system to the reference manual and see if its error conditions (-1, 127) can be handled correctly.