You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Peter Nabbefeld <Pe...@gmx.de> on 2005/06/23 10:05:31 UTC

How to pipe output to input?

Hello,

I've asked this question on the users list, but it seems nobody knows there:
Is it possible to create two java processes (with fork="true") and pipe 
the output of one process into the other? How? Can I focus a component? 
Or generate a mouse event?

I haven't found an example for this, neither in the FAQ nor using the 
search function, so I guess there is nothing other than the parameter 
description, which isn't very helpful.

Kind regards

Peter Nabbefeld


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Phil Weighill Smith <ph...@volantis.com>.
The key here is likely to be Sockets.

On Thu, 2005-06-23 at 10:05 +0200, Peter Nabbefeld wrote:
> Hello,
> 
> I've asked this question on the users list, but it seems nobody knows there:
> Is it possible to create two java processes (with fork="true") and pipe 
> the output of one process into the other? How? Can I focus a component? 
> Or generate a mouse event?
> 
> I haven't found an example for this, neither in the FAQ nor using the 
> search function, so I guess there is nothing other than the parameter 
> description, which isn't very helpful.
> 
> Kind regards
> 
> Peter Nabbefeld
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 23 Jun 2005, Steve Loughran <st...@apache.org> wrote:

> Schoedinger says the cat is only dead or alive when you open the bag

Well, it has died six or eight times already (depends on your culture,
German cats have seven lifes, I've been told other cats have nine).

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Steve Loughran <st...@apache.org>.
Dominique Devienne wrote:
>>From: Steve Loughran [mailto:stevel@apache.org]
>>well, it'd be nice if we could get/set unix file permissions; that is
>>the most important thing to me, symlinks would be good too. There are no
>>real symlinks in NTFS, though hard links are allowed in the same
>>filesystem.
> 
> 
> What about NTFS 'junctions' or 'reparse points' Steve?
> 
> These smell symlink to me, no? --DD
> 
> http://shell-shocked.org/article.php?id=284 
> 
> 

Ha, you are trying to catch me out.

while I reserve the right to be wrong, in this case I dont think I am.

As far as I am aware, they are effectively mount points; you can mount a 
new drive under c://users/something and the rest of drive C is unware of 
it, unless you do something filesys intensive and it suddenly gets a lot 
slower. I remember under win2k-no-SP delete didnt work properly, but I 
assume that is fixed now. (pause, no the article shows one problem, rm 
the link tries to delete the stuff underneath in explorer. Also windows 
shell treats drag and drop within a drive (its a move) differently from 
across drives (its a copy); reparsing may change semantics back to movement.

So while reparse points are symlink-ish, they are primarily there to let 
you
  -mount new drives under a big drive for server side stuff
  -add redirection for the fairly fancy NTFS distributed filesystem stuff,

Trivia point #1:  remember that Win2K is multipersonality; there is 
support for a (crippled) posix subsystem that is not a layer on top of 
win32 (like cygwin or java), but talks straight to the kernel. the posix 
mode has a different job inheritance pattern (you can fork, forked 
things are children). The posix subsystem supported hard links since 
nt3.1, while Win32 only officially added it in Win2K. Yet there was a 
back door that let you create hard links in win32, which was somewhere 
in the backup api, some IOCTL or something.

Trivia point #2: Win2K actually has a distributed link tracking service 
by default. If you give a file an object id (IOCTL_SET_OID or something 
similar), then when the file moves around, the DLTS tracks it. this lets 
other apps find it by asking for the OID, and not the name. And here is 
the cool thing: it works across network drives; you can move an 
OID-tagged file to a lan drive, and things that use OIDs will not break! 
Of course, nobody actually uses OIDs except bits of COM, and the Dist 
Link Tracking Service is one of the first NT Services I turn off on a 
new system, right after DRM-device-identifier.

Trivia point #3. NTFS supports multiple resource forks in a file, like 
MacOS.

echo test > file:2

to put something into a resource named "2" alongside the base resource 
(0). Again, nothing uses this except for some IIS security holes. We 
dont have support in Ant (":" is treated as special), and I have never 
tested java support anyway.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


RE: How to pipe output to input?

Posted by Matt Benson <gu...@yahoo.com>.
After reading the article, I see that it directly
conflicts what I said below.  Having no use for
Windows junctions at present, however, I will not be
(at this time) spending any time refuting my own past
experiences.  ;)

-Matt

--- Matt Benson <gu...@yahoo.com> wrote:

> 
> --- Dominique Devienne <dd...@gmail.com> wrote:
> 
> > > From: Steve Loughran [mailto:stevel@apache.org]
> > > well, it'd be nice if we could get/set unix file
> > permissions; that is
> > > the most important thing to me, symlinks would
> be
> > good too. There are no
> > > real symlinks in NTFS, though hard links are
> > allowed in the same
> > > filesystem.
> > 
> > What about NTFS 'junctions' or 'reparse points'
> > Steve?
> 
> I was under the impression these were the "hard
> links"
> Steve referred to above.  In my experience junctions
> work a) only for directories, and b) only on a
> single
> disk ("filesystem" above).  Not an issue on Unix
> systems, but can be inhibiting under Windows.
> 
> -Matt
> 
> > 
> > These smell symlink to me, no? --DD
> > 
> > http://shell-shocked.org/article.php?id=284 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > dev-help@ant.apache.org
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 



		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


RE: How to pipe output to input?

Posted by Matt Benson <gu...@yahoo.com>.
--- Dominique Devienne <dd...@gmail.com> wrote:

> > From: Steve Loughran [mailto:stevel@apache.org]
> > well, it'd be nice if we could get/set unix file
> permissions; that is
> > the most important thing to me, symlinks would be
> good too. There are no
> > real symlinks in NTFS, though hard links are
> allowed in the same
> > filesystem.
> 
> What about NTFS 'junctions' or 'reparse points'
> Steve?

I was under the impression these were the "hard links"
Steve referred to above.  In my experience junctions
work a) only for directories, and b) only on a single
disk ("filesystem" above).  Not an issue on Unix
systems, but can be inhibiting under Windows.

-Matt

> 
> These smell symlink to me, no? --DD
> 
> http://shell-shocked.org/article.php?id=284 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


RE: How to pipe output to input?

Posted by Dominique Devienne <dd...@gmail.com>.
> From: Steve Loughran [mailto:stevel@apache.org]
> well, it'd be nice if we could get/set unix file permissions; that is
> the most important thing to me, symlinks would be good too. There are no
> real symlinks in NTFS, though hard links are allowed in the same
> filesystem.

What about NTFS 'junctions' or 'reparse points' Steve?

These smell symlink to me, no? --DD

http://shell-shocked.org/article.php?id=284 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Steve Loughran <st...@apache.org>.
Kev Jackson wrote:

>>
>> As with most bits of unix (i.e. symlinks), it is a shame that the Nt 
>> implementation isnt as seamless as the unix one. it means we can't 
>> easily work with it to provide a portable pipe mechanism that the OS 
>> handles. But if you can stick to unix,  pipes make a good IPC 
>> mechanism. And like I said, if you have a proper clustering OS, those 
>> pipes work across machines in the cluster.
>>
> Would a minimal Java+JNI interface be a useful thing to have?  Would 
> anyone use it?  A portable library would be good for this kind of thing, 
> indeed a cross-platform mechanism for symlinks would be good too, or 
> wouldn't it?
> 


well, it'd be nice if we could get/set unix file permissions; that is 
the most important thing to me, symlinks would be good too. There are no 
real symlinks in NTFS, though hard links are allowed in the same filesystem.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Kev Jackson <ke...@it.fts-vn.com>.
>>
>> Well!  I am ashamed to say I had never encountered the
>> mkfifo command.  My only contact with "named pipes"
>
[snip interesting pipes discussion]

My only contact with named pipes was in the abomination that was 
WebSphere 3.5.1 (you had choices of Java, Corba or "Named Pipes" as a 
config option, forget what it was about, but pipes was the recommeded 
setting, even on Nt 4)

Doesn't Oracle also have something similar for it's network config?  I'm 
sure I've seen pipes listed as an option instead of TCP when configuring 
oracleNet, if they mean unix pipes that's fairly cool.

>> and everything works as expected on Unix.  This also
>> works on cygwin EXCEPT that the <delete> does not fail
>> in Ant yet still fails to delete the pipe.  But since
>> fifos would be implemented in god-only-knows-what-way
>> that is unsurprising.  Cool.
>
>
Nice

>
> As with most bits of unix (i.e. symlinks), it is a shame that the Nt 
> implementation isnt as seamless as the unix one. it means we can't 
> easily work with it to provide a portable pipe mechanism that the OS 
> handles. But if you can stick to unix,  pipes make a good IPC 
> mechanism. And like I said, if you have a proper clustering OS, those 
> pipes work across machines in the cluster.
>
Would a minimal Java+JNI interface be a useful thing to have?  Would 
anyone use it?  A portable library would be good for this kind of thing, 
indeed a cross-platform mechanism for symlinks would be good too, or 
wouldn't it?

Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Steve Loughran <st...@apache.org>.
Matt Benson wrote:
> --- Steve Loughran <st...@apache.org> wrote:
> [SNIP]
> 
>>I see. It is a lot easier to delegate to the OS,
>>isnt it:
>>
>><exec executable="mkfifo" osfamily="unix">
>>	<arg file="./pipe" />
>></exec>
> 
> 
> Well!  I am ashamed to say I had never encountered the
> mkfifo command.  My only contact with "named pipes"
> had been in O'Reilly's "Learning the bash shell" in
> which the  >(foo) and <(bar) constructs for piping
> to/from processes are covered briefly.  Named pipes
> are mentioned, I assume because they are implicitly
> created by this bash syntax.
> 
> I tried this:
> <exec executable="mkfifo">
>   <arg file="myfifo" />
> </exec>
> <parallel>
>   <echo file="myfifo">
> foo
> bar
> baz
> etc
>   </echo>
>   <concat>
>     <fileset file="myfifo" />
>   </concat>
> </parallel>
> <delete file="myfifo" />
> 
> and everything works as expected on Unix.  This also
> works on cygwin EXCEPT that the <delete> does not fail
> in Ant yet still fails to delete the pipe.  But since
> fifos would be implemented in god-only-knows-what-way
> that is unsurprising.  Cool.


well there you go, you have learned something new. I've been using named 
pipes where needed since, what, 1988. they are the most wonderfully 
minimal bit of IPC on the planet.

WinNT has named pipes for network shares, which are an explicit bit of 
remote IPC; you use  ::CreateNamedPipe to create them. The funny is they 
arent just simple nodes in the filesystem, they live in a special 
\\machine\pipe\ place:-
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/createnamedpipe.asp

I presume this is what cygwin is using, though I dont know how they map 
them to files in the filesystem, that is a miracle of hackery.

As with most bits of unix (i.e. symlinks), it is a shame that the Nt 
implementation isnt as seamless as the unix one. it means we can't 
easily work with it to provide a portable pipe mechanism that the OS 
handles. But if you can stick to unix,  pipes make a good IPC mechanism. 
And like I said, if you have a proper clustering OS, those pipes work 
across machines in the cluster.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Matt Benson <gu...@yahoo.com>.
--- Steve Loughran <st...@apache.org> wrote:
[SNIP]
> 
> I see. It is a lot easier to delegate to the OS,
> isnt it:
> 
> <exec executable="mkfifo" osfamily="unix">
> 	<arg file="./pipe" />
> </exec>

Well!  I am ashamed to say I had never encountered the
mkfifo command.  My only contact with "named pipes"
had been in O'Reilly's "Learning the bash shell" in
which the  >(foo) and <(bar) constructs for piping
to/from processes are covered briefly.  Named pipes
are mentioned, I assume because they are implicitly
created by this bash syntax.

I tried this:
<exec executable="mkfifo">
  <arg file="myfifo" />
</exec>
<parallel>
  <echo file="myfifo">
foo
bar
baz
etc
  </echo>
  <concat>
    <fileset file="myfifo" />
  </concat>
</parallel>
<delete file="myfifo" />

and everything works as expected on Unix.  This also
works on cygwin EXCEPT that the <delete> does not fail
in Ant yet still fails to delete the pipe.  But since
fifos would be implemented in god-only-knows-what-way
that is unsurprising.  Cool.

-Matt


		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Steve Loughran <st...@apache.org>.
Matt Benson wrote:

> Hmm.  I don't know for sure to which part you were
> referring.  My lack here is that of having a clue how
> to delegate this to the OS as you suggested,
> especially in elegant Java form, or further how to
> make such applicable to I/O-intensive processes that
> are NOT native processes.  Java is like a womb I am
> reluctant to leave, at least in this context.  Or,
> "Sounds like a PITA."  ;)
> 
> -Matt

I see. It is a lot easier to delegate to the OS, isnt it:

<exec executable="mkfifo" osfamily="unix">
	<arg file="./pipe" />
</exec>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Matt Benson <gu...@yahoo.com>.
--- Steve Loughran <st...@hpl.hp.com> wrote:

> Matt Benson wrote:
> > --- Steve Loughran <st...@apache.org> wrote:
> 
> >>>-Matt
> >>
> >>Interesting design. I would have done a <namedpipe
> >>id="" /> datatype 
> >>that did the synchronisation; producers and
> >>consumers would sync by 
> >>choice of pipename.
> > 
> > 
> > That could work, for isolation.  How would you
> specify
> > the roles of producer/consumer?  Not that it
> matters
> > too much, because:
> 
> 
> It depends on the role. If you ask a named pipe for
> an input stream, you 
> get an input stream, become a reader and block until
> there is a writer. 
> If you ask one for an output stream, you get an
> output stream and block 
> once the buffer is full. If >1 thing wants to be a
> reader or writer, 
> signal a fault. (in unix you can have multiple
> readers or writers, but I 
> dont want to complicate close() semantics with new
> reference counted 
> closers)

Okay, still there would be a syntax issue at some
point for configuration of producer or consumer.  But
if other issues are insurmountable that question is,
again, moot.  As for multiple producers/consumers, Ant
already contains support for multiple writers in the
oata.util.OutputStreamFunneler class, which I had to
add to get right the behavior of output & error going
to a single stream as is often the case.  Multiple
readers plays with my head; in plain I/O usage (not
message queues or anything) each reader would (one
would think) want all data, so multiple copies or the
illusion thereof would be desirable... seems like it
would be best, then, to allow multiple writers to a
pipe, because we can, but to disallow multiple
readers.  The workaround for multiple readers would
then be to attach a single pass-through reader whose
output was split to multiple (differently) named
writers.
> > 
> >>But like you say, the problem
> >>becomes process 
> >>co-ordination; handling failures and propagating
> >>them gracefully, or 
> >>just how to keep processes around until their
> >>consumer/producer was 
> >>there. This is the stuff we normally delegate to
> the
> >>OS, or, for 
> >>distrubution, to some message queue. Though named
> >>pipes work across 
> >>clusters, at least on the apollo and hpux cluster
> >>systems.
> >>
> > 
> > This grows beyond my level of understanding.  :)
> 
> ahh, go and build it, you will soon learn. I've used
> unix named pipes in 
> the past, and think they are a very cool form of
> IPC; like a socket but 
> with better decoupling of produce/consume.

Hmm.  I don't know for sure to which part you were
referring.  My lack here is that of having a clue how
to delegate this to the OS as you suggested,
especially in elegant Java form, or further how to
make such applicable to I/O-intensive processes that
are NOT native processes.  Java is like a womb I am
reluctant to leave, at least in this context.  Or,
"Sounds like a PITA."  ;)

-Matt
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 



		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Steve Loughran <st...@hpl.hp.com>.
Matt Benson wrote:
> --- Steve Loughran <st...@apache.org> wrote:

>>>-Matt
>>
>>Interesting design. I would have done a <namedpipe
>>id="" /> datatype 
>>that did the synchronisation; producers and
>>consumers would sync by 
>>choice of pipename.
> 
> 
> That could work, for isolation.  How would you specify
> the roles of producer/consumer?  Not that it matters
> too much, because:


It depends on the role. If you ask a named pipe for an input stream, you 
get an input stream, become a reader and block until there is a writer. 
If you ask one for an output stream, you get an output stream and block 
once the buffer is full. If >1 thing wants to be a reader or writer, 
signal a fault. (in unix you can have multiple readers or writers, but I 
dont want to complicate close() semantics with new reference counted 
closers)

> 
> 
>>But like you say, the problem
>>becomes process 
>>co-ordination; handling failures and propagating
>>them gracefully, or 
>>just how to keep processes around until their
>>consumer/producer was 
>>there. This is the stuff we normally delegate to the
>>OS, or, for 
>>distrubution, to some message queue. Though named
>>pipes work across 
>>clusters, at least on the apollo and hpux cluster
>>systems.
>>
> 
> This grows beyond my level of understanding.  :)

ahh, go and build it, you will soon learn. I've used unix named pipes in 
the past, and think they are a very cool form of IPC; like a socket but 
with better decoupling of produce/consume.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Matt Benson <gu...@yahoo.com>.
--- Steve Loughran <st...@apache.org> wrote:

> Matt Benson wrote:
[SNIP]
> > Yep.  To let my own proverbial (dead) cat out of
> the
> > bag,
> 
> Schoedinger says the cat is only dead or alive when
> you open the bag

:) I gotta finish my "smart books" about quantum
computing and "Goedel, Escher, Bach"...
> 
> > this was one of my original goals when I exposed
> > the redirector functionality.  After committing
> the
> > current functionality, I had added the additional
> > concept of an (input|output|error)ref attribute: 
> > inputref would specify a reference to an
> inputstream
> > from which input should be read; (output|error)ref
> > would specify a reference to an inputstream from
> which
> > another process could read, created using a
> > PipedOutputStream->PipedInputStream (actually an
> > oata.util.LeadPipeInputStream) set.  Concurrency
> > issues were solved by a ProxyInputStream class;
> while
> > locking at the Redirector class level (no new
> stream
> > references added), the Project would be probed for
> the
> > named InputStream.  If none were found, a
> > ProxyInputStream would be created that would
> continue
> > to search for the (literally) "named pipe".  This
> all
> > worked like a charm...
> > 
> > ...on Unix (Solaris, I like to think it probably
> would
> > have worked on other Unix systems).  I could not
> for
> > all the world convince the stupid Windows JREs not
> to
> > deadlock on any but the simplest uses of this.  I
> have
> > since lost that bit of code, but could re-create
> if
> > any Threading gurus want to take a stab at it.
> > 
> > -Matt
> 
> Interesting design. I would have done a <namedpipe
> id="" /> datatype 
> that did the synchronisation; producers and
> consumers would sync by 
> choice of pipename.

That could work, for isolation.  How would you specify
the roles of producer/consumer?  Not that it matters
too much, because:

> But like you say, the problem
> becomes process 
> co-ordination; handling failures and propagating
> them gracefully, or 
> just how to keep processes around until their
> consumer/producer was 
> there. This is the stuff we normally delegate to the
> OS, or, for 
> distrubution, to some message queue. Though named
> pipes work across 
> clusters, at least on the apollo and hpux cluster
> systems.
> 
This grows beyond my level of understanding.  :)

-Matt

> -steve


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Steve Loughran <st...@apache.org>.
Matt Benson wrote:
> --- Steve Loughran <st...@apache.org> wrote:
> 
> 
>>Peter Nabbefeld wrote:
>>
>>>Hello,
>>>
>>>I've asked this question on the users list, but it
>>
>>seems nobody knows 
>>
>>>there:
>>>Is it possible to create two java processes (with
>>
>>fork="true") and pipe 
>>
>>>the output of one process into the other?
>>
>>Not yet :)
>>
>>Ant1.6.2 added the notion of the ioredirector to
>>exec and java, but no 
>>direct coupling of apps. You'd have to write your
>>own filter to route 
>>the stuff...and ant equivalent of Unix named pipes
> 
> 
> Yep.  To let my own proverbial (dead) cat out of the
> bag,

Schoedinger says the cat is only dead or alive when you open the bag

> this was one of my original goals when I exposed
> the redirector functionality.  After committing the
> current functionality, I had added the additional
> concept of an (input|output|error)ref attribute: 
> inputref would specify a reference to an inputstream
> from which input should be read; (output|error)ref
> would specify a reference to an inputstream from which
> another process could read, created using a
> PipedOutputStream->PipedInputStream (actually an
> oata.util.LeadPipeInputStream) set.  Concurrency
> issues were solved by a ProxyInputStream class; while
> locking at the Redirector class level (no new stream
> references added), the Project would be probed for the
> named InputStream.  If none were found, a
> ProxyInputStream would be created that would continue
> to search for the (literally) "named pipe".  This all
> worked like a charm...
> 
> ...on Unix (Solaris, I like to think it probably would
> have worked on other Unix systems).  I could not for
> all the world convince the stupid Windows JREs not to
> deadlock on any but the simplest uses of this.  I have
> since lost that bit of code, but could re-create if
> any Threading gurus want to take a stab at it.
> 
> -Matt

Interesting design. I would have done a <namedpipe id="" /> datatype 
that did the synchronisation; producers and consumers would sync by 
choice of pipename. But like you say, the problem becomes process 
co-ordination; handling failures and propagating them gracefully, or 
just how to keep processes around until their consumer/producer was 
there. This is the stuff we normally delegate to the OS, or, for 
distrubution, to some message queue. Though named pipes work across 
clusters, at least on the apollo and hpux cluster systems.

-steve




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Matt Benson <gu...@yahoo.com>.
--- Steve Loughran <st...@apache.org> wrote:

> Peter Nabbefeld wrote:
> > 
> > Hello,
> > 
> > I've asked this question on the users list, but it
> seems nobody knows 
> > there:
> > Is it possible to create two java processes (with
> fork="true") and pipe 
> > the output of one process into the other?
> 
> Not yet :)
> 
> Ant1.6.2 added the notion of the ioredirector to
> exec and java, but no 
> direct coupling of apps. You'd have to write your
> own filter to route 
> the stuff...and ant equivalent of Unix named pipes

Yep.  To let my own proverbial (dead) cat out of the
bag, this was one of my original goals when I exposed
the redirector functionality.  After committing the
current functionality, I had added the additional
concept of an (input|output|error)ref attribute: 
inputref would specify a reference to an inputstream
from which input should be read; (output|error)ref
would specify a reference to an inputstream from which
another process could read, created using a
PipedOutputStream->PipedInputStream (actually an
oata.util.LeadPipeInputStream) set.  Concurrency
issues were solved by a ProxyInputStream class; while
locking at the Redirector class level (no new stream
references added), the Project would be probed for the
named InputStream.  If none were found, a
ProxyInputStream would be created that would continue
to search for the (literally) "named pipe".  This all
worked like a charm...

...on Unix (Solaris, I like to think it probably would
have worked on other Unix systems).  I could not for
all the world convince the stupid Windows JREs not to
deadlock on any but the simplest uses of this.  I have
since lost that bit of code, but could re-create if
any Threading gurus want to take a stab at it.

-Matt



		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: How to pipe output to input?

Posted by Steve Loughran <st...@apache.org>.
Peter Nabbefeld wrote:
> 
> Hello,
> 
> I've asked this question on the users list, but it seems nobody knows 
> there:
> Is it possible to create two java processes (with fork="true") and pipe 
> the output of one process into the other?

Not yet :)

Ant1.6.2 added the notion of the ioredirector to exec and java, but no 
direct coupling of apps. You'd have to write your own filter to route 
the stuff...and ant equivalent of Unix named pipes

If you are running unix only, you can just use named pipes


> How? Can I focus a component? 
> Or generate a mouse event?
> 

um, you have just gone way out of what is normally done in app 
automation. There is nothing in Ant to do this. Some of the GUI unit 
test frameworks do enable it, however...

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org