This repository was archived by the owner on Apr 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed
Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ const (
2727 AgentNoPermissionError = 22
2828)
2929
30+ var lastLines []string
31+
3032func appendPrefixToCmd (cmd * exec.Cmd ) error {
3133 stderr , err := cmd .StderrPipe ()
3234 if err != nil {
@@ -42,6 +44,10 @@ func appendPrefixToCmd(cmd *exec.Cmd) error {
4244 for scanner .Scan () {
4345 msg := scanner .Text ()
4446 fmt .Printf ("FUZZER: %s\n " , msg )
47+ lastLines = append (lastLines , msg )
48+ if len (lastLines ) > 1000 {
49+ lastLines = lastLines [500 :]
50+ }
4551 }
4652 }()
4753
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ type crash struct {
4646 Type string `firestore:"type"`
4747 Time time.Time `firestore:"time,serverTimestamp"`
4848 V2 bool `firestore:"v2"`
49+ LastLines string `firestore:"last_lines"`
4950}
5051
5152type FuzzitClient struct {
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ func (c *FuzzitClient) uploadCrash(exitCode int) error {
122122 OrgId : c .Org ,
123123 ExitCode : uint32 (exitCode ),
124124 Type : "crash" ,
125+ LastLines : strings .Join (lastLines , "\n " ),
125126 V2 : true ,
126127 })
127128 if err != nil {
Original file line number Diff line number Diff line change @@ -202,3 +202,12 @@ func createDirIfNotExist(path string) error {
202202 }
203203 return nil
204204}
205+
206+ func Contains (arr []string , str string ) bool {
207+ for _ , a := range arr {
208+ if a == str {
209+ return true
210+ }
211+ }
212+ return false
213+ }
You can’t perform that action at this time.
0 commit comments