SapphireDensetsu / ypsilon

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

`system' return code not (portably) interpretable #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The integer returned by the 'system' procedure is not (portably)
interpretable by Scheme code (in C it as to be destructured by the
WIFEXITED() macro & co.):

    Ypsilon 0.9.6-trunk/r416 Copyright (c) 2009 Y.Fujita, LittleWing
Company Limited.
    > (system "exit 42")
    10752

[FWIW, Ikarus has the same issue:
https://bugs.launchpad.net/ikarus/+bug/349210]

One a related note, I'd also suggest making the terminating signal
available from the `process' API family, perhaps by providing a
variant of `process-wait' that returns both exit status and
terminating signal.

Original issue reported on code.google.com by rott...@gmail.com on 30 Mar 2009 at 12:16

GoogleCodeExporter commented 8 years ago
Thank you for your suggestion!
-- fujita

Original comment by y.fujita...@gmail.com on 30 Mar 2009 at 4:19

GoogleCodeExporter commented 8 years ago
I have fixed the bug and trunk directory is updated to revision 417.

Ypsilon 0.9.6-trunk/r417 Copyright (c) 2009 Y.Fujita, LittleWing Company 
Limited.
> (system "exit 42")
42

Regarding process-wait,
I have experimentally modified process-wait and it returns (- WTERMSIG(status)) 
if
child process terminated by signal.

Ypsilon 0.9.6-trunk/r417 Copyright (c) 2009 Y.Fujita, LittleWing Company 
Limited.
> (define pid (car (process "/bin/sh" "-c" "exit 42")))
> (process-wait pid #t)
42
> (define pid (car (process "cat")))
> (system (format "kill -TERM ~a" pid))
0
> (process-wait pid #t)
-15

Your comments are very welcome! Thank you!
--fujita

Original comment by y.fujita...@gmail.com on 6 Apr 2009 at 1:48

GoogleCodeExporter commented 8 years ago
For consistency, I'd do the same for `system' as well; patch attached.

Original comment by rott...@gmail.com on 6 Apr 2009 at 2:46

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for your help. :)
I have updated 'system'.
Thank you!
--fujita

Original comment by y.fujita...@gmail.com on 7 Apr 2009 at 1:24