guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incorrect documentation for system, system*, and/or waitpid?


From: Chris Marusich
Subject: Incorrect documentation for system, system*, and/or waitpid?
Date: Sat, 13 Oct 2018 13:26:59 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi,

I was reading about the "system" and "system*" procedures in the Guile
manual, and it seems like the actual behavior of Guile seems to
contradict what the manual says.  I'm using Guile version 2.2.4.

The Guile manual says that these procedures return the exit status as
returned by waitpid:

 -- Scheme Procedure: system [cmd]
 -- C Function: scm_system (cmd)
     Execute CMD using the operating system’s “command processor”.
     Under Unix this is usually the default shell ‘sh’.  The value
     returned is CMD’s exit status as returned by ‘waitpid’ [...].

 -- Scheme Procedure: system* arg1 arg2 ...
 -- C Function: scm_system_star (args)
     [...]

     This function returns the exit status of the command as provided by
     ‘waitpid’.  This value can be handled with ‘status:exit-val’ and
     the related functions.

     [...]

And the documentation for "waitpid" says:

 -- Scheme Procedure: waitpid pid [options]
 -- C Function: scm_waitpid (pid, options)
     [...]

     The return value is a pair containing:

       1. The process ID of the child process, or 0 if ‘WNOHANG’ was
          specified and no process was collected.
       2. The integer status value.

However, the return value doesn't appear to be a pair:

    scheme@(guile-user)> (system "true")
    $1 = 0
    scheme@(guile-user)> (pair? $1)
    $2 = #f
    scheme@(guile-user)> (system* "true")
    $3 = 0
    scheme@(guile-user)> (pair? $3)
    $4 = #f
    scheme@(guile-user)> 

In spite of this, the procedures like status:exit-val do seem to work as
expected:

    scheme@(guile-user)> (status:exit-val $1)
    $5 = 0
    scheme@(guile-user)> (status:exit-val $3)
    $6 = 0

Is the documentation incorrect?  I checked the Guile source for the
system procedure, and it seemed to me like the documentation is
incorrect, but I'm not 100% sure, since I'm not very familiar with the
Guile source code, so I thought I'd ask here to make sure.

Thank you for your help!

-- 
Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]