mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
		
			
				
	
	
		
			33 lines
		
	
	
		
			609 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			609 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package pty
 | 
						|
 | 
						|
import (
 | 
						|
	"os"
 | 
						|
	"os/exec"
 | 
						|
	"syscall"
 | 
						|
)
 | 
						|
 | 
						|
// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
 | 
						|
// and c.Stderr, calls c.Start, and returns the File of the tty's
 | 
						|
// corresponding pty.
 | 
						|
func Start(c *exec.Cmd) (pty *os.File, err error) {
 | 
						|
	pty, tty, err := Open()
 | 
						|
	if err != nil {
 | 
						|
		return nil, err
 | 
						|
	}
 | 
						|
	defer tty.Close()
 | 
						|
	c.Stdout = tty
 | 
						|
	c.Stdin = tty
 | 
						|
	c.Stderr = tty
 | 
						|
	if c.SysProcAttr == nil {
 | 
						|
		c.SysProcAttr = &syscall.SysProcAttr{}
 | 
						|
	}
 | 
						|
	c.SysProcAttr.Setctty = true
 | 
						|
	c.SysProcAttr.Setsid = true
 | 
						|
	err = c.Start()
 | 
						|
	if err != nil {
 | 
						|
		pty.Close()
 | 
						|
		return nil, err
 | 
						|
	}
 | 
						|
	return pty, err
 | 
						|
}
 |