Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit 958efb4

Browse files
author
Yevgeny Pats
committed
fix --skip-if-not-exists
1 parent 4af48df commit 958efb4

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

client/agent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ const (
2525
jqfSuccessExitCode = 0
2626

2727
fuzzingInterval = 3600
28+
29+
AgentGeneralError = 1
30+
AgentNoPermissionError = 22
2831
)
2932

3033
func libFuzzerExitCodeToStatus(exitCode int) string {

client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
const FuzzitEndpoint = "https://app.fuzzit.dev"
14-
const Version = "v2.4.54"
14+
const Version = "v2.4.55"
1515

1616
type Target struct {
1717
Name string `firestore:"target_name"`

cmd/job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var jobCmd = &cobra.Command{
7575

7676
if newJob.Type == "local-regression" {
7777
err = gFuzzitClient.CreateLocalJob(newJob, args[1:])
78-
if err != nil && skipIfNotExist && err.Error() == "401 Unauthorized" {
78+
if err != nil && skipIfNotExist && (err.Error() == "401 Unauthorized" || err.Error() == "fuzzer exited with 22") {
7979
log.Println("Target doesn't exist yet. skipping...")
8080
return
8181
}

cmd/run.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/fuzzitdev/fuzzit/v2/client"
2121
"github.com/spf13/cobra"
2222
"log"
23+
"os"
2324
)
2425

2526
var runJob = client.Job{}
@@ -44,9 +45,13 @@ var runCmd = &cobra.Command{
4445
}
4546

4647
err = gFuzzitClient.RunFuzzer(runJob, jobId, updateDB)
47-
4848
if err != nil {
49-
log.Fatalln(err)
49+
log.Println(err)
50+
if err.Error() == "401 Unauthorized" {
51+
os.Exit(client.AgentNoPermissionError)
52+
} else {
53+
os.Exit(client.AgentGeneralError)
54+
}
5055
}
5156
},
5257
Hidden: true,

0 commit comments

Comments
 (0)