fortify: clean ps output
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Test / Create distribution (push) Successful in 26s
				
			
		
			
				
	
				Test / Sandbox (push) Successful in 1m40s
				
			
		
			
				
	
				Test / Fortify (push) Successful in 2m34s
				
			
		
			
				
	
				Test / Sandbox (race detector) (push) Successful in 2m52s
				
			
		
			
				
	
				Test / Fpkg (push) Successful in 3m36s
				
			
		
			
				
	
				Test / Fortify (race detector) (push) Successful in 4m5s
				
			
		
			
				
	
				Test / Flake checks (push) Successful in 1m3s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Test / Create distribution (push) Successful in 26s
				
			Test / Sandbox (push) Successful in 1m40s
				
			Test / Fortify (push) Successful in 2m34s
				
			Test / Sandbox (race detector) (push) Successful in 2m52s
				
			Test / Fpkg (push) Successful in 3m36s
				
			Test / Fortify (race detector) (push) Successful in 4m5s
				
			Test / Flake checks (push) Successful in 1m3s
				
			This format never changed ever since it was added. It used to show everything there is in a process state but that is no longer true for a long time. This change cleans it up in favour of `fortify show` displaying extra information. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
		
							parent
							
								
									bdee0c3921
								
							
						
					
					
						commit
						ecdd4d8202
					
				
							
								
								
									
										18
									
								
								print.go
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								print.go
									
									
									
									
									
								
							@ -247,22 +247,18 @@ func printPs(output io.Writer, now time.Time, s state.Store, short, flagJSON boo
 | 
			
		||||
	t := newPrinter(output)
 | 
			
		||||
	defer t.MustFlush()
 | 
			
		||||
 | 
			
		||||
	t.Println("\tInstance\tPID\tApp\tUptime\tEnablements\tCommand")
 | 
			
		||||
	t.Println("\tInstance\tPID\tApplication\tUptime")
 | 
			
		||||
	for _, e := range exp {
 | 
			
		||||
		var (
 | 
			
		||||
			es = "(No confinement information)"
 | 
			
		||||
			cs = "(No command information)"
 | 
			
		||||
			as = "(No configuration information)"
 | 
			
		||||
		)
 | 
			
		||||
		as := "(No configuration information)"
 | 
			
		||||
		if e.Config != nil {
 | 
			
		||||
			es = e.Config.Confinement.Enablements.String()
 | 
			
		||||
			cs = fmt.Sprintf("%q", e.Config.Args)
 | 
			
		||||
			as = strconv.Itoa(e.Config.Confinement.AppID)
 | 
			
		||||
			if e.Config.ID != "" {
 | 
			
		||||
				as += " (" + e.Config.ID + ")"
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		t.Printf("\t%s\t%d\t%s\t%s\t%s\t%s\n",
 | 
			
		||||
			e.s[:8], e.PID, as, now.Sub(e.Time).Round(time.Second).String(), strings.TrimPrefix(es, ", "), cs)
 | 
			
		||||
		t.Printf("\t%s\t%d\t%s\t%s\n",
 | 
			
		||||
			e.s[:8], e.PID, as, now.Sub(e.Time).Round(time.Second).String())
 | 
			
		||||
	}
 | 
			
		||||
	t.Println()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type expandedStateEntry struct {
 | 
			
		||||
 | 
			
		||||
@ -458,20 +458,16 @@ func Test_printPs(t *testing.T) {
 | 
			
		||||
		short, json bool
 | 
			
		||||
		want        string
 | 
			
		||||
	}{
 | 
			
		||||
		{"no entries", make(state.Entries), false, false, `    Instance    PID    App    Uptime    Enablements    Command
 | 
			
		||||
 | 
			
		||||
		{"no entries", make(state.Entries), false, false, `    Instance    PID    Application    Uptime
 | 
			
		||||
`},
 | 
			
		||||
		{"no entries short", make(state.Entries), true, false, ``},
 | 
			
		||||
		{"nil instance", state.Entries{testID: nil}, false, false, `    Instance    PID    App    Uptime    Enablements    Command
 | 
			
		||||
 | 
			
		||||
		{"nil instance", state.Entries{testID: nil}, false, false, `    Instance    PID    Application    Uptime
 | 
			
		||||
`},
 | 
			
		||||
		{"state corruption", state.Entries{fst.ID{}: testState}, false, false, `    Instance    PID    App    Uptime    Enablements    Command
 | 
			
		||||
 | 
			
		||||
		{"state corruption", state.Entries{fst.ID{}: testState}, false, false, `    Instance    PID    Application    Uptime
 | 
			
		||||
`},
 | 
			
		||||
 | 
			
		||||
		{"valid", state.Entries{testID: testState}, false, false, `    Instance    PID           App    Uptime     Enablements                  Command
 | 
			
		||||
    8e2c76b0    3735928559    9      1h2m32s    wayland, dbus, pulseaudio    ["chromium" "--ignore-gpu-blocklist" "--disable-smooth-scrolling" "--enable-features=UseOzonePlatform" "--ozone-platform=wayland"]
 | 
			
		||||
 | 
			
		||||
		{"valid", state.Entries{testID: testState}, false, false, `    Instance    PID           Application                  Uptime
 | 
			
		||||
    8e2c76b0    3735928559    9 (org.chromium.Chromium)    1h2m32s
 | 
			
		||||
`},
 | 
			
		||||
		{"valid short", state.Entries{testID: testState}, true, false, `8e2c76b0
 | 
			
		||||
`},
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user