Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #29839
| From | Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: A "current directory" concept for Java... |
| Date | 2014-08-24 13:41 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrnlvjqru.fp3.avl@login.logic.tuwien.ac.at> (permalink) |
| References | (3 earlier) <lta871$22r$1@dont-email.me> <slrnlvhgf8.fp3.avl@login.logic.tuwien.ac.at> <ltaqbk$gnc$1@dont-email.me> <slrnlvj9aq.fp3.avl@login.logic.tuwien.ac.at> <ltcfa4$9ag$1@dont-email.me> |
Martin Gregorie <martin@address-in-sig.invalid> wrote: > On Sun, 24 Aug 2014 08:42:02 +0000, Andreas Leitgeb wrote: >> ProcessBuilder has a couple of methods to tell what to do with spawnee's >> streams. You can set them up to be redirected to current process's >> streams, cause them to be redirected to files and some more options. > What I was commenting about is that calling ProcessBuilder.start() > creates a Process and must start the load and process it controls since > there is apparently no Process.start or Process.run method. ProcessBuilder.start() really starts the new Process. > I was expecting to have either: > - a way of redirecting the standard streams provided by ProcessBuilder > as well as the redirectErrorStream() switch that would do the job > before ProcessBuilder.start is called > - the ability to use the Process.getXXXStream() methods before calling > a method that would allow the Process to run. The redirection is always done with redirectXxx() methods of ProcessBuilder. If you redirect to a file, then the started Process will instantly see its respective standard descriptor connected to that file. If you redirect to "INHERIT", then the started Process will instantly see its respective standard descriptor connected to whatever its parent's respective descriptor is tied to. If you redirect to a pipe (which is the case if you don't call any of ProcessBuilder's redirectXxx methods), then the started Process will instantly see its respective standard descriptor connected to some pipe. The only thing that appears to me as missing is, when I'd like to tie one Process's output to another Process's input. I must admit that I haven't seen (nor needed, nor googled) that case, yet. >> It's only when you keep it at default, then it is set up for >> pipe-streams and what you then do with the created Process is merely >> pick up your side of these established streams. > So, you are saying that the Process actually runs for a short time until > it either wants input or fills an output buffer and then blocks ... so far: yes > until the streams have been redirected via the getXXXStream() methods? Streams aren't "redirected" by calling getXXXStream(). These streams already(from start) have been directed to some pipe. With getXXXStream() you just obtain a handle to that pipe, almost in the same way as System.in gives you a handle to current Process' own stdin. (That's what I meant with "picking up" parent's own end of the pipe.) > If so, that seems like a somewhat mickey mouse approach. The only bit missing (and I'm not sure if it is really missing) is, that I can't short-circuit two sub-Process' pipes. All pipes defined through ProcessBuilder.redirectXxx() are between parent and child, not between two sibling childs. >> Could be a legacy from old Dos-days, where installed programs often >> expected to be invoked from their installation directory. Thats when >> one had a couple of .bat files for each application, that would cd to >> the respective one's installation dir and then start the application. > Agreed. I haven't done much/any programming in the Windows environment > since W95, I left that world already in the days of 3.1 in favour of version 0.99pl14 of a different, rather new kernel back then. My guesstimate would be: if a process is started from shell, then the user has a specific expectation about its "current" dir, and any words passed as arguments could be relative paths (even if not (yet) existing as files) and therefore the current dir would need to be the current directory of the shell. Otoh, if a program is started through double click of a File whose type is associated to the Program, then the program only gets an absolute Path, and thus the current dir is "by definition" irrelevant. A third case is, when a Program gets started through a double-click on its own icon or a shortcut/link-icon. I have no idea what current dir to expect there. Fortunately for me, these cases are not relevant to my projects at hand ;-)
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-22 16:49 +0000
Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 14:50 -0400
Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 15:10 -0400
Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-22 19:26 +0000
Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-22 23:38 +0000
Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-23 14:24 +0000
Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 16:31 +0000
Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-23 19:34 +0000
Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 08:42 +0000
Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-24 10:37 +0000
Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 13:41 +0000
Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-24 18:33 +0000
Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 22:33 +0000
Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-25 00:14 +0000
Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 19:45 -0400
Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 15:32 +0000
Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-23 12:49 -0400
Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-23 17:40 -0400
Re: A "current directory" concept for Java... Jan Burse <janburse@fastmail.fm> - 2014-08-23 10:31 +0200
With new Path (Re: A "current directory" concept for Java...) Jan Burse <janburse@fastmail.fm> - 2014-08-23 10:48 +0200
Re: With new Path (Re: A "current directory" concept for Java...) Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 14:38 +0000
Re: A "current directory" concept for Java... Roedy Green <see_website@mindprod.com.invalid> - 2014-08-23 05:31 -0700
csiph-web