[plt-scheme] system and system/exit-code under Mac OS X

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Oct 29 13:30:44 EDT 2007

On Oct 29, Jens Axel Soegaard wrote:
> Hi all,
> 
> I have a problem with "system" under Mac OS X 10.4 and
> wish to know whether I my expectations are wrong,
> or whether there is a bug somewhere.
> 
> I have an object file that prints a little
> on standard out, and then returns with the
> exit code 0.
> 
> Using "system" from (lib "process.ss") which
> synchronously executes I get this result:
> 
>    > (system "./test/test-1193675986-324921376.o")
>    #f
> 
> The #f means that the exit-code was non-zero, so
> I tried system/exit-code and got:
> 
>    > (system/exit-code "./test/test-1193675986-324921376.o")
>    -1
> 
> As a sanity test I tried the thing in Perl:
> 
>   $ perl -e "printf(system(\"./test/test-1193675986-324921376.o\\"))"
>   <the output>
>   0
> 
> The 0 is the exit status.
> 
> Executed directly in the shell I get:
> 
>    $ ./test/test-1193675986-324921376.o
>    <the output>
>    $ echo $?
>    0
> 
> so at least the shell and Perl results are consistent.
> 
> The function "system" in (lib "process.ss") is defined as:
> 
>    (define (system str)
>      (if (eq? (system-type) 'macos)
> 	(subprocess #f #f #f "by-id" str)
> 	(apply system* (shell-path/args "system" str))))
> 
> And the documentation for subprocess says that it
> executes the command asynchronously, which seems fishy,
> but maybe the "by-id" initiates some magic?

That line is old code, which is not relevant to you -- your
system-type should be `macosx', not `macos'.  (So the problem is
there, but I don't know where it's coming from.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.