XU XUv0.8.8
EN

API

#os/exec

import: #os/exec

counts: 3 函数, 9 方法, 1 类型, 0 常量, 0 方法集

进程执行:参数数组、run/output/combined_output、start/wait 与标准输入输出管道。

struct Cmd

XuAPI
pub struct Cmd {
    pub path string
    pub args []string
    pub dir string
    pub ctx context.Context
    pub has_ctx int
}

用途

公开结构体 `Cmd`。

参数

path string
文件系统路径
args []string
可变实参
dir string
目录
ctx context.Context
字段(context.Context)
has_ctx int
字段(int)

(&mut Cmd) set_dir

XuAPI
pub fn (c &mut Cmd) set_dir(dir string)

用途

`&mut Cmd` 上的方法:设置 dir。

参数

c &mut Cmd
接收者 &mut Cmd(可变借用)
dir string
目录(string)

command

XuAPI
pub fn command(name string, args <-> string) Cmd

用途

命令。

参数

name string
名字(string)
args <-> string
可变参数,类型 string,在函数体内是 []string

返回

Cmd — 该类型的值

command_context

XuAPI
pub fn command_context(ctx context.Context, name string, args <-> string) Cmd

用途

命令上下文。

参数

ctx context.Context
ctx(context.Context)
name string
名字(string)
args <-> string
可变参数,类型 string,在函数体内是 []string

返回

Cmd — 该类型的值

look_path

XuAPI
pub fn look_path(file string) string

用途

lookpath。失败时 throw。

参数

file string
file(string)

返回

string — 结果字符串

(&Cmd) run

XuAPI
pub fn (c &Cmd) run() int

用途

`&Cmd` 上的方法:运行。失败时 throw。

参数

c &Cmd
接收者 &Cmd(借用)

返回

int — 该类型的值

(&Cmd) output

XuAPI
pub fn (c &Cmd) output() string

用途

`&Cmd` 上的方法:输出。失败时 throw。

参数

c &Cmd
接收者 &Cmd(借用)

返回

string — 结果字符串

(&mut Cmd) close_unstarted_pipes

XuAPI
pub fn (c &mut Cmd) close_unstarted_pipes()

用途

`&mut Cmd` 上的方法:关闭unstartedpipes。

参数

c &mut Cmd
接收者 &mut Cmd(可变借用)

(&mut Cmd) stdout_pipe

XuAPI
pub fn (c &mut Cmd) stdout_pipe() os.File

用途

`&mut Cmd` 上的方法:stdoutpipe。失败时 throw。

参数

c &mut Cmd
接收者 &mut Cmd(可变借用)

返回

os.File — 该类型的值

(&mut Cmd) stdin_pipe

XuAPI
pub fn (c &mut Cmd) stdin_pipe() os.File

用途

`&mut Cmd` 上的方法:stdinpipe。失败时 throw。

参数

c &mut Cmd
接收者 &mut Cmd(可变借用)

返回

os.File — 该类型的值

(&mut Cmd) start

XuAPI
pub fn (c &mut Cmd) start() int

用途

`&mut Cmd` 上的方法:启动。失败时 throw。

参数

c &mut Cmd
接收者 &mut Cmd(可变借用)

返回

int — 该类型的值

(&mut Cmd) wait

XuAPI
pub fn (c &mut Cmd) wait() int

用途

`&mut Cmd` 上的方法:等待。失败时 throw。

参数

c &mut Cmd
接收者 &mut Cmd(可变借用)

返回

int — 该类型的值

(&Cmd) combined_output

XuAPI
pub fn (c &Cmd) combined_output() string

用途

`&Cmd` 上的方法:合并输出输出。失败时 throw。

参数

c &Cmd
接收者 &Cmd(借用)

返回

string — 结果字符串