File: debug.go

package info (click to toggle)
debos 1.0.0+git20190123.d6e16be-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 256 kB
  • sloc: sh: 13; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 567 bytes parent folder | download | duplicates (2)
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()
	}
}