Re: Struggling in making a sub-process work in an interactive way

2012-01-13 Thread Denis Labaye
I replied a bit too fast, I didn't realized you wanted to such an advanced thing It is probably more a JVM question than a Clojure question then. On Fri, Jan 13, 2012 at 3:42 AM, jaime wrote: > Well actually I also tried commons-exec but it's the same as > clojure.java.shell - they run system c

Re: Struggling in making a sub-process work in an interactive way

2012-01-12 Thread jaime
Well actually I also tried commons-exec but it's the same as clojure.java.shell - they run system command directly, after execution they return and terminate. That's not the way I want On Jan 13, 2:42 am, Denis Labaye wrote: > Hi, > > In Java you would do it with common-exec:http://commons.ap

Re: Struggling in making a sub-process work in an interactive way

2012-01-12 Thread Denis Labaye
Hi, In Java you would do it with common-exec: http://commons.apache.org/exec/ So add the deps to your project.clj : :dependencies [[org.apache.commons/commons-exec "1.1"]] And use Clojure's Java interop. Keep us posted, I will need to do the same thing soon :) Denis On Wed, Jan 11, 2012 at 4

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread jaime
I didn't read your code carefully yet but I think you're meaning to copy streams between my Clojure code and the sub-process, actually I've tried this but this is probably not what I want. I might not make myself clear. So here I go again: 1. I writing a program which will open an OS shell (that

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread Ryan Waters
On Mon, Jan 9, 2012 at 11:20 PM, jaime wrote: > > now it works fine for NON-interactive command such as "dir" or "help", > but it will hang when I send the shell commands that require user > input, such as "time". I think the reason is that my code doesn't > detect any input requirement so the she

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread Phil Hagelberg
Alan Malloy writes: > On Jan 9, 9:24 pm, Phil Hagelberg wrote: >> As far as I know this is impossible to do without bringing in >> third-party libraries; this is just a (rather serious) shortcoming of >> the JDK. I haven't looked into it enough to know which libraries would >> offer it though. >

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread Alan Malloy
On Jan 9, 9:24 pm, Phil Hagelberg wrote: > jaime writes: > > Later on I tried to add code that can make this possible but I found > > there's no way to detect if a command requires user's input and thus I > > have to find another way to make it work - but I didn't success and > > have been strugg

Re: Struggling in making a sub-process work in an interactive way

2012-01-09 Thread Phil Hagelberg
jaime writes: > Later on I tried to add code that can make this possible but I found > there's no way to detect if a command requires user's input and thus I > have to find another way to make it work - but I didn't success and > have been struggling for a workaround for a long while > > anyo

Struggling in making a sub-process work in an interactive way

2012-01-09 Thread jaime
Hello there, I'm writing some code, int my code it does following things (under Windows): 1. create a sub-process by "(.exec (Runtime/getRuntime) "cmd")" named "shell" 2. get input-stream, output-stream and err-stream from the shell object 3. send commands to "shell" by dropping line into the outp