Re: STDIN and STDOUT

2000-05-24 Thread John Green

That code is only run after a fork.  On os2 and win32, the
spawn_with_handles code is run instead of fork'ing.

John

On Wed, May 24, 2000 at 01:57:26PM +0200, Philip Newton wrote:
 Joe Schell wrote:
  I couldn't be sure.  I just looked at it briefly and many 
  code segments like this
  
  xopen \*STDERR, "" . fileno $dad_err
  
  seems to suggest that it might be relying on operating system 
  redirection that Win 9x doesn't have.
 
 No, that's Perl syntax. See `perldoc -f open`. You can use  and  (and
 friends) to open files from file descriptors or file handles.
 
 Cheers,
 Philip
 
 ---
 You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
 To unsubscribe, forward this message to
  [EMAIL PROTECTED]
 For non-automated Mailing List support, send email to  
  [EMAIL PROTECTED]
 

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: STDIN and STDOUT

2000-05-23 Thread Bellenger, Bruno (Paris)


I'm not sure I fully understand why you care about capturing the output 
if you don't really need to analyze what's coming back from the command.

But you can always try some of the following.

In NT, you can usually send data to a command line in two ways, 
which, to say the truth, may not work in all cases nor with all programs. 
You've got to experiment a bit.

One way is to echo something and pipe it to a command, such as in 

echo Y | del %TEMP%

You can redirect STDOUT if you want to, the command just doesn't 
care at all :

echo Y | del %TEMP%  nul 21


Another way, and this can be useful if you need to provide more that one 
answer, is to redirect the content of a file to a command :

command  myfile  nul 21 

or 

type myfile | command  nul 21


where myfile contains the proper answers to the prompts that 
will be emitted by 'command', one on each line, to provide the 
return character. 
Empty lines can play the return char. only. 
I've seen cases where you needed to manually add the return 
char. (ASCII 13), that not all editors can handle with grace. 

In Perl, you can provide input to a process or capture output, but as 
you mention, not both at once. What you might be able to do though, 
is prompt the user via Perl (if you need to), then check and write the 
answers to a file which you can then redirect to your command, if it 
will accept that.

Not the most elegant solution, but it might work.

In fact, it might be easier to open the filehandle to write to the process 
while redirecting the whole output to a file, then read the content of that 
file when all is finished, if you need some kind of return information.

Give this a try and let us know.

_
Bruno Bellenger
Sr. Network/Systems Administrator 

-Original Message-
From:   Clint Mahoney [SMTP:[EMAIL PROTECTED]]
Sent:   Monday, May 22, 2000 18:08
To: Perl-Win32-Users Mailing List
Subject:STDIN and STDOUT

Is there a way to open a process as a filehandle that
captures
STDOUT and lets you send STDIN at the same time?  I know how to do
both
separately.
I need to send data to a command at the command line that
answers
two prompts.  I guess I don't really need to analyze what's coming
back
from the command but I definitely need to be able to send two pieces
of
data in answer to the two prompts.  Surely there's some way.  
Thanks in advance - everyone on this mailing list is so
helpful!

-Clint


---


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: STDIN and STDOUT

2000-05-23 Thread Joe Schell

Does Open3 work on Win 9x?  When I looked at the code it seemed to be using
'2' which doesn't work on Win 9x.

 Behalf Of John Green


 Clint,

 Look at the documentation for IPC::Open2 and IPC::Open3
 both do what you want.  IPC::Open2 will not capture STDERR,
 IPC::Open3 will.

 John

 On Mon, May 22, 2000 at 11:08:13AM -0500, Clint Mahoney wrote:
  Is there a way to open a process as a filehandle that captures
  STDOUT and lets you send STDIN at the same time?  I know how to do both
  separately.
  I need to send data to a command at the command line that answers
  two prompts.  I guess I don't really need to analyze what's coming back
  from the command but I definitely need to be able to send two pieces of
  data in answer to the two prompts.  Surely there's some way.
  Thanks in advance - everyone on this mailing list is so helpful!
 
  -Clint
 
 


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




Re: STDIN and STDOUT

2000-05-23 Thread John Green

Joe,

I'm not sure - I use NT.  The path through the code of Open3 on MSWin32
doesn't include any '2', though.

John

On Tue, May 23, 2000 at 08:43:01AM -0600, Joe Schell wrote:
 Does Open3 work on Win 9x?  When I looked at the code it seemed to be using
 '2' which doesn't work on Win 9x.
 
  Behalf Of John Green
 
 
  Clint,
 
  Look at the documentation for IPC::Open2 and IPC::Open3
  both do what you want.  IPC::Open2 will not capture STDERR,
  IPC::Open3 will.
 
  John
 
  On Mon, May 22, 2000 at 11:08:13AM -0500, Clint Mahoney wrote:
 Is there a way to open a process as a filehandle that captures
   STDOUT and lets you send STDIN at the same time?  I know how to do both
   separately.
 I need to send data to a command at the command line that answers
   two prompts.  I guess I don't really need to analyze what's coming back
   from the command but I definitely need to be able to send two pieces of
   data in answer to the two prompts.  Surely there's some way.
 Thanks in advance - everyone on this mailing list is so helpful!
  
 -Clint
  
  
 
 
 ---
 You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
 To unsubscribe, forward this message to
  [EMAIL PROTECTED]
 For non-automated Mailing List support, send email to  
  [EMAIL PROTECTED]
 

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




Re: STDIN and STDOUT

2000-05-22 Thread Paul Rogers [CE]

Does your command line program accept command line arguments?

As in:

$command = open(FILE,"c:\\apps\\blah.exe -arg1 blaharg|");

What command are you trying to execute?

p ---



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]