summaryrefslogtreecommitdiff
path: root/debug.go
diff options
context:
space:
mode:
authorHéctor Orón Martínez <zumbi@debian.org>2018-01-09 19:12:07 +0100
committerHéctor Orón Martínez <zumbi@debian.org>2018-01-09 19:12:07 +0100
commit4808cb7058c548bf76476ec2f9618d784d76bdda (patch)
tree1dc1e8cc24171783fc8d9da306b1e92798960a15 /debug.go
New upstream version 1.0.0+git20171222.87b0d5e
Diffstat (limited to 'debug.go')
-rw-r--r--debug.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/debug.go b/debug.go
new file mode 100644
index 0000000..1fd1356
--- /dev/null
+++ b/debug.go
@@ -0,0 +1,31 @@
+package debos
+
+import (
+ "fmt"
+ "log"
+ "os"
+)
+
+/*
+DebugShell function launches an interactive shell for
+debug and problems investigation.
+*/
+func DebugShell(context DebosContext) {
+
+ if len(context.DebugShell) == 0 {
+ return
+ }
+
+ pa := os.ProcAttr{
+ Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
+ Dir: context.Scratchdir,
+ }
+
+ // Start an interactive shell for debug.
+ log.Printf(">>> Starting a debug shell")
+ if proc, err := os.StartProcess(context.DebugShell, []string{}, &pa); err != nil {
+ fmt.Printf("Failed: %s\n", err)
+ } else {
+ proc.Wait()
+ }
+}