Opened 7 years ago

Closed 7 years ago

#914 closed defect (invalid)

run-program on MS-Windows does not collect output in a stream.

Reported by: pjb@… Owned by:
Priority: normal Milestone:
Component: Runtime (threads, GC) Version: trunk
Keywords: run-program windows Cc:

Description

On linux:

 (with-output-to-string (out)
        (ccl:run-program
         "/bin/sh"
         '("-c" "echo hello")
         :input nil :output out :wait t))
"hello
"

which is the expected result.

On MS-Windows:

(with-output-to-string (out)
            (ccl:run-program
             "C:/cygwin/bin/sh"
             '("-c" "echo  hello")
             :input nil :output out :wait t))
"
"

which is not expected. Notice that run-program runs successfully:

(ccl:run-program
           "C:/cygwin/bin/sh"
           '("-c" "echo  hello")
           :input nil :output (make-string-output-stream) :wait t)
#<external-process (C:/cygwin/bin/sh -c
                    echo  hello)[nil] (exited : 0) #x2108DC3B8D>

but the output is not collected.

(list (lisp-implementation-type) (lisp-implementation-version)
               (machine-type) (machine-version))
("Clozure Common Lisp" "Version 1.7-r14925M  (Windowsx8664)" "x64" nil)

Change History (4)

comment:1 Changed 7 years ago by gb

So ... either those things that depend on being able to capture the output of an external process on Windows and appear to work don't really work, or something else is going on with your examples.

I haven't looked at this yet, but I find the second possibility a better theory.

comment:2 Changed 7 years ago by gb

  • Component changed from Cocotron to Runtime (threads, GC)

comment:3 Changed 7 years ago by pjb@…

Yes. One strange thing is that the returned string contains a newline. If no output was captured, I would have expected an empty string. So there may be something fishy outside of ccl.

Keep in mind that I'm calling out a cygwin shell to run the command. (I tried to call out cmd.exe giving its full path without success, I'm not a MS-Windows user or programmer).

There's the question of the choice of the shell to run the command on MS-Windows on the part of ccl, obvioulsy "/bin/sh" doesn't work there.

comment:4 Changed 7 years ago by gb

  • Resolution set to invalid
  • Status changed from new to closed

I don't know what the issue with the original test case was or is, but it's clear that the stated problem description isn't valid (and it's fairly clear that whatever problem "sh -c echo ..." has has nothing to do with CCL.)

Note: See TracTickets for help on using tickets.