1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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()
}
}
|