Skip to content

Commit 041be8b

Browse files
committed
Add command argument to run
1 parent 7067f9a commit 041be8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/terminal/terminal.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (t *Terminal) ForceRedraw() {
7777
}
7878

7979
// Run starts the terminal/shell proxying process
80-
func (t *Terminal) Run() error {
80+
func (t *Terminal) Run(commands ...string) error {
8181

8282
if !t.enableNesting {
8383
if os.Getenv("SHOX") != "" {
@@ -137,6 +137,10 @@ func (t *Terminal) Run() error {
137137
}
138138
defer func() { _ = terminal.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort.
139139

140+
for _, command := range commands {
141+
_, _ = t.pty.Write([]byte(command + "\n"))
142+
}
143+
140144
// Copy stdin to the pty and the pty to stdout.
141145
go func() { _ = lazyCopy(t.pty, os.Stdin) }()
142146
go func() { _ = lazyCopy(os.Stdout, t.proxy, t.hideAllOutput) }()

0 commit comments

Comments
 (0)