@@ -238,7 +238,12 @@ func executeCommand(hooksGroup, commandName string, wg *sync.WaitGroup) {
238
238
return
239
239
}
240
240
241
+ // pty part start
242
+ defer func () { ptyOut .Close () }() // Make sure to close the pty at the end.
243
+ // Copy stdin to the pty and the pty to stdout.
244
+ go func () { io .Copy (ptyOut , os .Stdin ) }()
241
245
io .Copy (os .Stdout , ptyOut )
246
+ // pty part end
242
247
243
248
if command .Wait () == nil {
244
249
okList = append (okList , commandName )
@@ -275,7 +280,6 @@ func executeScript(hooksGroup, source string, executable os.FileInfo, wg *sync.W
275
280
276
281
command = exec .Command (runnerArg [0 ], runnerArg [1 :]... )
277
282
}
278
- command .Stdin = os .Stdin
279
283
280
284
ptyOut , err := pty .Start (command )
281
285
mutex .Lock ()
@@ -306,7 +310,12 @@ func executeScript(hooksGroup, source string, executable os.FileInfo, wg *sync.W
306
310
return
307
311
}
308
312
313
+ // pty part start
314
+ defer func () { ptyOut .Close () }() // Make sure to close the pty at the end.
315
+ // Copy stdin to the pty and the pty to stdout.
316
+ go func () { io .Copy (ptyOut , os .Stdin ) }()
309
317
io .Copy (os .Stdout , ptyOut )
318
+ // pty part end
310
319
311
320
if command .Wait () == nil {
312
321
okList = append (okList , executableName )
0 commit comments