Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecWithPTY ¶
ExecWithPTY executes a command in a pseudo-terminal with optional output masking.
This function provides TTY emulation while allowing masking of sensitive data in output. It integrates with Atmos's existing pkg/io masking infrastructure.
Platform Support:
- macOS: Fully supported
- Linux: Fully supported
- Windows: Not supported (use regular exec.Cmd.Run instead)
Limitations:
- PTY merges stderr and stdout into single stream
- EIO errors may occur when reading from closed PTY (this is normal)
- Terminal size must be synchronized with host terminal
Example:
ctx := context.Background()
cmd := exec.Command("docker", "exec", "-it", containerID, "bash")
opts := &Options{
Masker: ioCtx.Masker(),
EnableMasking: true,
}
err := ExecWithPTY(ctx, cmd, opts)
func IsSupported ¶
func IsSupported() bool
IsSupported returns true if PTY operations are supported on this platform.
Currently supported platforms:
- darwin (macOS)
- linux
Not supported:
- windows (PTY operations require Unix-like system calls)
Types ¶
type Options ¶
type Options struct {
// Masker is the masking implementation from pkg/io.
Masker iolib.Masker
// EnableMasking enables output masking through the PTY proxy.
EnableMasking bool
// Stdin provides input to the PTY. If nil, defaults to os.Stdin.
Stdin io.Reader
// Stdout receives output from the PTY. If nil, defaults to os.Stdout.
Stdout io.Writer
// Stderr receives error output from the PTY. Note: PTY merges stderr with stdout.
// This is preserved for API consistency but data will not flow here in PTY mode.
Stderr io.Writer
}
Options represents configuration for PTY execution.
Click to show internal directories.
Click to hide internal directories.