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

Can't get process*/ports to work



Greetings,

I want a process to write its output to a file and for its stdin I
want an output port to which I can write.

Using MzScheme 102/16, the following code (with missing pieces
filled)

(call-with-output-file foofile
  (lambda (fooport)
    (match-let (((stdout stdin process-id stderr waiter)
                 (apply process*/ports fooport #f #f
                        ...)))
      (printf "~A,~A,~A,~A,~A~%" stdout stdin process-id stderr waiter)
      ...)))

prints

"process*: expects type <file-stream-input-port> as 1st argument,
 given: #<stream-output-port>;"

which doesn't make any sense to me, because documentation says:

"(process/ports output-port input-port error-output-port
command-string) is like process, except that output-port is used
for the process's standard output,"

so why on earth does it want file-stream-**input**-port when the
documentation says it wants output-port?  If I assume that the
documentation is incorrect and the first and the second parameters
should be swapped and I thus pass fooport as the second parameter,
I get...

#<stream-input-port>,#f,3695,#<stream-input-port>,#<primitive:control-process>

...from my printf, which doesn't make any sense either, because I'm
expecting second element to be an output port chained to process'
standard input.  I passed an output port to process*/ports so the
first element of the returned list should not be input port but
#f.

So I guess that swapping wasn't a good idea after all and the
documentation is correct but something else is fucked up.  What
could that be?

-- 
Hannu