This commit is contained in:
Solomon Hykes 2013-02-26 17:26:46 -08:00
parent 754cf30b0e
commit df5134f46e
2 changed files with 86 additions and 90 deletions

View File

@ -1,8 +1,8 @@
package client
import (
"github.com/dotcloud/docker/rcli"
"github.com/dotcloud/docker/future"
"github.com/dotcloud/docker/rcli"
"io"
"io/ioutil"
"log"
@ -112,7 +112,7 @@ func InteractiveMode(scripts ...string) error {
return err
}
io.WriteString(rcfile, "enable -n help\n")
os.Setenv("PATH", tmp + ":" + os.Getenv("PATH"))
os.Setenv("PATH", tmp+":"+os.Getenv("PATH"))
os.Setenv("PS1", "\\h docker> ")
shell := exec.Command("/bin/bash", append([]string{"--rcfile", rcfile.Name()}, scripts...)...)
shell.Stdin = os.Stdin

View File

@ -15,7 +15,6 @@ type Termios struct {
Ospeed uintptr
}
const (
// Input flags
inpck = 0x010
@ -74,7 +73,7 @@ const (
ONOCR = 0x20
ONOEOT = 0x8
OPOST = 0x1
RENB = 0x1000
RENB = 0x1000
PARMRK = 0x8
PARODD = 0x2000
@ -136,12 +135,9 @@ func MakeRaw(fd int) (*State, error) {
return &oldState, nil
}
// Restore restores the terminal connected to the given file descriptor to a
// previous state.
func Restore(fd int, state *State) error {
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(setTermios), uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0)
return err
}