From bc6303f15d9ac4f2f281bbf4e4d76f7517e10117 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Fri, 4 Apr 2014 17:30:03 -0700 Subject: [PATCH] beam/examples/beamsh: 'chdir' changes the current directory Docker-DCO-1.1-Signed-off-by: Solomon Hykes (github: shykes) --- pkg/beam/examples/beamsh/beamsh.go | 2 ++ pkg/beam/examples/beamsh/builtins.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pkg/beam/examples/beamsh/beamsh.go b/pkg/beam/examples/beamsh/beamsh.go index c444d0a6e..d8b401168 100644 --- a/pkg/beam/examples/beamsh/beamsh.go +++ b/pkg/beam/examples/beamsh/beamsh.go @@ -323,6 +323,8 @@ func GetHandler(name string) Handler { return CmdOpenfile } else if name == "spawn" { return CmdSpawn + } else if name == "chdir" { + return CmdChdir } return nil } diff --git a/pkg/beam/examples/beamsh/builtins.go b/pkg/beam/examples/beamsh/builtins.go index d4e084dde..08b8a6259 100644 --- a/pkg/beam/examples/beamsh/builtins.go +++ b/pkg/beam/examples/beamsh/builtins.go @@ -436,3 +436,7 @@ func CmdOpenfile(args []string, stdout, stderr io.Writer, in beam.Receiver, out } } } + +func CmdChdir(args []string, stdout, stderr io.Writer, in beam.Receiver, out beam.Sender) { + os.Chdir(args[1]) +}