Skip to content

Commit 27dd1a4

Browse files
authored
feat: pass stdin to watched commands (#1195)
1 parent 9b34663 commit 27dd1a4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmd/templ/generatecmd/run/run_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func Run(ctx context.Context, workingDir string, input string) (cmd *exec.Cmd, e
7575
cmd.WaitDelay = time.Second * 3
7676
cmd.Env = os.Environ()
7777
cmd.Dir = workingDir
78+
cmd.Stdin = os.Stdin
7879
cmd.Stdout = os.Stdout
7980
cmd.Stderr = os.Stderr
8081
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

cmd/templ/generatecmd/run/run_windows.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ import (
1111
"sync"
1212
)
1313

14-
var m = &sync.Mutex{}
15-
var running = map[string]*exec.Cmd{}
14+
var (
15+
m = &sync.Mutex{}
16+
running = map[string]*exec.Cmd{}
17+
)
1618

1719
func KillAll() (err error) {
1820
m.Lock()
@@ -61,6 +63,7 @@ func Run(ctx context.Context, workingDir string, input string) (cmd *exec.Cmd, e
6163
cmd = exec.Command(executable, args...)
6264
cmd.Env = os.Environ()
6365
cmd.Dir = workingDir
66+
cmd.Stdin = os.Stdin
6467
cmd.Stdout = os.Stdout
6568
cmd.Stderr = os.Stderr
6669
running[input] = cmd

0 commit comments

Comments
 (0)