Skip to content

Commit d2bc801

Browse files
authored
Merge pull request #59 from lpabon/exit
Report correct exit status
2 parents e599b52 + d8a6624 commit d2bc801

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

mock/main.go

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2018 Kubernetes Authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package main
217

318
import (
@@ -16,11 +31,11 @@ func main() {
1631
endpoint := os.Getenv("CSI_ENDPOINT")
1732
if len(endpoint) == 0 {
1833
fmt.Println("CSI_ENDPOINT must be defined and must be a path")
19-
return
34+
os.Exit(1)
2035
}
2136
if strings.Contains(endpoint, ":") {
2237
fmt.Println("CSI_ENDPOINT must be a unix path")
23-
return
38+
os.Exit(1)
2439
}
2540

2641
// Create mock driver
@@ -39,14 +54,15 @@ func main() {
3954
fmt.Printf("Error: Unable to listen on %s socket: %v\n",
4055
endpoint,
4156
err)
42-
return
57+
os.Exit(1)
4358
}
4459
defer os.Remove(endpoint)
4560

4661
// Start server
4762
if err := d.Start(l); err != nil {
4863
fmt.Printf("Error: Unable to start mock CSI server: %v\n",
4964
err)
65+
os.Exit(1)
5066
}
5167
fmt.Println("mock driver started")
5268

0 commit comments

Comments
 (0)