|
@@ -79,9 +79,9 @@ func SetVariableDefault(variable, value string) {
|
79
|
79
|
// PostProcessor is a function that applies post-processing to the report output
|
80
|
80
|
type PostProcessor func(input []byte, output io.Writer, ui plugin.UI) error
|
81
|
81
|
|
82
|
|
-// WaitForVisualizer makes pprof wait for visualizers to complete
|
83
|
|
-// before continuing, returning any errors.
|
84
|
|
-var waitForVisualizer = true
|
|
82
|
+// interactiveMode is true if pprof is running on interactive mode, reading
|
|
83
|
+// commands from its shell.
|
|
84
|
+var interactiveMode = false
|
85
|
85
|
|
86
|
86
|
// pprofCommands are the report generation commands recognized by pprof.
|
87
|
87
|
var pprofCommands = commands{
|
|
@@ -361,7 +361,7 @@ var kcachegrind = []string{"kcachegrind"}
|
361
|
361
|
// the screen.
|
362
|
362
|
func awayFromTTY(format string) PostProcessor {
|
363
|
363
|
return func(input []byte, output io.Writer, ui plugin.UI) error {
|
364
|
|
- if output == os.Stdout && ui.IsTerminal() {
|
|
364
|
+ if output == os.Stdout && (ui.IsTerminal() || interactiveMode) {
|
365
|
365
|
tempFile, err := newTempFile("", "profile", "."+format)
|
366
|
366
|
if err != nil {
|
367
|
367
|
return err
|
|
@@ -443,7 +443,9 @@ func invokeVisualizer(format PostProcessor, suffix string, visualizers []string)
|
443
|
443
|
defer func(t <-chan time.Time) {
|
444
|
444
|
<-t
|
445
|
445
|
}(time.After(time.Second))
|
446
|
|
- if waitForVisualizer {
|
|
446
|
+ // On interactive mode, let the visualizer run on the background
|
|
447
|
+ // so other commands can be issued.
|
|
448
|
+ if !interactiveMode {
|
447
|
449
|
return viewer.Wait()
|
448
|
450
|
}
|
449
|
451
|
return nil
|