nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.Runtime / IORedirectFile

IORedirectFile

Full name Microsoft.VisualBasic.CommandLine.IORedirectFile Assembly Microsoft.VisualBasic.Runtime Members 15

Using this class object rather than IORedirect is more encouraged. (假若所建立的子进程并不需要进行终端交互,相较于IORedirect对象,更加推荐使用本对象类型来执行。 似乎IORedirect对象在创建一个子进程的时候的对象IO重定向的句柄的处理有问题,所以在这里构建一个更加简单的类型对象, 这个IO重定向对象不具备终端交互功能)

00 Remarks

先重定向到一个临时文件之中,然后再返回临时文件给用户代码

01 Syntax

Microsoft.VisualBasic.CommandLine.IORedirectFile

02 Methods

NameOverloadsSummary
CopyRedirect 1 将目标子进程的标准终端输出文件复制到一个新的文本文件之中
.ctor 1 Using this class object rather than IORedirect is more encouraged if there is no console interactive with your folked process.
Run 1 Start target child process and then wait for the child process exits.
Start 2 启动子进程,但是不等待执行完毕,当目标子进程退出的时候,回调procExitCallback函数句柄
ToString 1
Dispose 1

03 Properties

NameOverloadsSummary
StandardOutput 1 目标子进程的终端标准输出
Bin 1
CLIArguments 1
redirectDevice 1

04 Fields

NameOverloadsSummary
_TempRedirect 1 重定向的临时文件
shellScript 1 shell文件接口

05 Events

NameOverloadsSummary
ProcessExit 2 The target invoked process event has been exit with a specific return code.(目标派生子进程已经结束了运行并且返回了一个错误值)

06 Members

method CopyRedirect #
CopyRedirect(String)

将目标子进程的标准终端输出文件复制到一个新的文本文件之中

Parameters
NameTypeDescription
CopyToPathString

-

method .ctor #
#ctor(String, String, IEnumerable(Of KeyValuePair(Of String, String)), Boolean, String, String, Boolean, Boolean, Nullable(Of Boolean))

Using this class object rather than IORedirect is more encouraged if there is no console interactive with your folked process.

Parameters
NameTypeDescription
fileString

The program file. (请注意检查路径参数,假若路径之中包含有%这个符号的话,在调用cmd的时候会失败)

argvString

The program commandline arguments. (请注意检查路径参数,假若路径之中包含有%这个符号的话,在调用cmd的时候会失败)

environmentIEnumerable(Of KeyValuePair(Of String, String))

Temporary environment variable

folkNewBoolean

Folk the process on a new console window if this parameter value is TRUE

stdRedirectString

If not want to redirect the std out to your file, just leave this value blank.

method Run #
Run

Start target child process and then wait for the child process exits. So that the thread will be stuck at here until the sub process is job done! (启动目标子进程,然后等待执行完毕并返回退出代码(请注意,在进程未执行完毕 之前,整个线程会阻塞在这里))

method Start #
Start(Action)

启动子进程,但是不等待执行完毕,当目标子进程退出的时候,回调procExitCallback函数句柄

Parameters
NameTypeDescription
procExitCallbackAction

-

property StandardOutput #
StandardOutput

目标子进程的终端标准输出

field _TempRedirect #
_TempRedirect

重定向的临时文件

Remarks

当使用.tmp拓展名的时候会由于APP框架里面的GC线程里面的自动临时文件清理而产生冲突,所以这里需要其他的文件拓展名来避免这个冲突

field shellScript #
shellScript

shell文件接口

event ProcessExit #
ProcessExit

The target invoked process event has been exit with a specific return code.(目标派生子进程已经结束了运行并且返回了一个错误值)

Parameters
NameDescription
exitCode

-

exitTime

-

property Bin #
Bin
property CLIArguments #
CLIArguments
property redirectDevice #
redirectDevice
method Start overload 2 #
Start(Boolean, String(), Boolean)
method ToString #
ToString()
method Dispose #
Dispose()
event ProcessExit overload 2 #
ProcessExit