Update: The previous response was about how to close stdin on a process spawned from Perl, but the question is really about how to perform the task in .NET.
The idea is the same. You want to close the handle to the new process's standard input stream. In .NET, that can be done with
app.StandardInput.Close()
immediately after the call to app.Start()
.
(I think you'll also want to set app.StartInfo.RedirectStandardInput = true
, but I'm not much of a .NET programmer and I'm not sure about that).
NUL
is a Windows convention, like Unix's /dev/null
. But on Unix > NUL
will create a file called "NUL"
, and < NUL
will cause your system call (i.e. system
, backticks, etc.) to fail unless there is a file called "NUL"
.
That said, there are portable ways in Perl to close the standard input to a spawned process. For example:
open $fh, "| $command > outputfile 2> errorfile";
close $fh;
will launch $command
and immediately close $command
's standard input handle, as if you ran the command from the command line and immediately hit ^D
.