From be7d4c5b8c17ea47efd9b9ba7a47da5e9689d582 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) --- beam/examples/beamsh/beamsh.go | 2 ++ beam/examples/beamsh/builtins.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/beam/examples/beamsh/beamsh.go b/beam/examples/beamsh/beamsh.go index c444d0a..d8b4011 100644 --- a/beam/examples/beamsh/beamsh.go +++ b/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/beam/examples/beamsh/builtins.go b/beam/examples/beamsh/builtins.go index d4e084d..08b8a62 100644 --- a/beam/examples/beamsh/builtins.go +++ b/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]) +}