renumber
This commit is contained in:
16
069-exit/exit.go
Normal file
16
069-exit/exit.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// Exit
|
||||
|
||||
package main
|
||||
|
||||
// Use `os.Exit` to immediatly exit with a given
|
||||
// status.
|
||||
import "os"
|
||||
|
||||
func main() {
|
||||
// This `println` will never be reached because the
|
||||
// exit is immediate.
|
||||
defer println("!")
|
||||
os.Exit(3)
|
||||
}
|
||||
|
||||
// todo: discuss building before getting here
|
||||
11
069-exit/exit.sh
Normal file
11
069-exit/exit.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
# If you run `exit.go` using `go run`, the exit
|
||||
# will be picked up by `go` and printed.
|
||||
$ go run exit.go
|
||||
exit status 3
|
||||
|
||||
# By building and executing a binary you can see
|
||||
# the status in the terminal.
|
||||
$ go build exit.go
|
||||
$ ./exit
|
||||
$ echo $?
|
||||
3
|
||||
Reference in New Issue
Block a user