[plt-scheme] subprocess when current-directory is invalid

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed Feb 13 12:37:50 EST 2008

Given the following program, I get a weird error message:

#lang scheme/base
(parameterize ([current-directory (build-path "nonexistant-path")])
   (let-values ([(subp stdin stdout stderr)
                 (subprocess #f #f #f "/bin/ls")])
     (for ([ch stderr])
       (write-char (integer->char ch)))))

I know that this should fail, but the particular failure is weird:

###################################################################
XIO:  fatal IO error 9 (Bad file descriptor) on X server ":0.0"

       after 494681 requests (494681 known processed) with 0 events 
remaining.
###################################################################

Context: I had run into a bug in a larger program where I constructed a 
bad current-directory, saw the strange output from stderr, and had to 
chase a bit till I figured out the root cause.

Can the erroneous condition, that current-directory not being a real 
directory, be caught by subprocess even before it tries to execute?


Posted on the users mailing list.