# README
サンプルリスト
このディレクトリには以下のサンプルがあります。
file | example name | note |
---|---|---|
oneshot.go | cmdexec_oneshot | コマンドを一発実行して結果を取得するサンプルです |
oneshotwithstderr.go | cmdexec_oneshot_with_stderr | コマンドを一発実行して結果を取得するサンプルです。(標準エラー出力も含む) |
stdinouterr.go | cmdexec_stdinouterr | 標準入力・標準出力・標準エラー出力を指定してコマンドを実行するサンプルです |
withcontext.go | cmdexec_withcontext | コマンドを context.Context 付きで実行するサンプルです |
pipe.go | cmdexec_pipe | (*Cmd).StdinPipe,StdoutPipe,StderrPipeのサンプルです |
multi_command_with_pipe.go | cmdexec_multi_command_with_pipe | 複数の (*exec.Cmd) をパイプストリームで繋いで実行するサンプルです |
withenv.go | cmdexec_env | *exec.Cmd 実行時に追加の環境変数を指定するサンプルです |
withdir.go | cmdexec_dir | *exec.Cmd 実行時にワーキングディレクトリを指定するサンプルです |
withslice.go | cmdexec_slice | *exec.Cmd 実行時にスライスの値をコマンドの引数で指定するサンプルです |
# Functions
MultiCommandWithPipe は、複数の (*exec.Cmd) をパイプストリームで繋いで実行するサンプルです.
NewRegister -- このパッケージ用のサンプルを登録する mapping.Register を生成します。.
OneShot は、コマンドを一発実行して結果を取得するサンプルです.
OneShotWithStderr は、コマンドを一発実行して結果を取得するサンプルです。(標準エラー出力も含む)
REFERENCES: - https://golang.org/os/exec/#example_Cmd_CombinedOutput - https://www.gnu.org/software/bash/manual/bash.html#Redirecting-Standard-Output-and-Standard-Error - https://tldp.org/LDP/abs/html/io-redirection.html.
Pipe は、 (*Cmd).StdinPipe,StdoutPipe,StderrPipeのサンプルです。
REFERENCES: - https://golang.org/os/exec/#example_Cmd_StdinPipe.
Stdinouterr は、標準入力・標準出力・標準エラー出力を指定してコマンドを実行するサンプルです。
REFERENCES: - https://golang.org/os/exec/#example_Command.
WithContext は、context.Context 付きでコマンドを実行するサンプルです。.
WithDir -- *exec.Cmd 実行時にワーキングディレクトリを指定するサンプルです.
WithEnv -- *exec.Cmd 実行時に追加の環境変数を指定するサンプルです.
WithSlice -- *exec.Cmd 実行時にスライスの値をコマンドの引数で指定するサンプルです.