Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be4062b
commit 6217d8c
Showing
7 changed files
with
70 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
char *foo = "Hello world"; | ||
int main() { | ||
printf("%s\n", foo); | ||
return 42; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
import ( | ||
"syscall" | ||
"os/exec" | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
cmd := exec.Command("/bin/sh", "-c", "exit 42") | ||
cmd.Start() | ||
result := cmd.Wait() | ||
status := result.(*exec.ExitError).ProcessState.Sys().(syscall.WaitStatus) | ||
fmt.Printf("%v\n", status.ExitStatus()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
build: test | ||
|
||
test: test.go | ||
GOPATH=$(PWD) go build $< | ||
|
||
deps: src/cabin | ||
|
||
# 'go get' doesn't support repos with dashes in the name, and breaking my pattern | ||
# of calling repos '<language>-<repo>' is silly, especially when calling it "gocabin" | ||
# requires all my code to use 'go...' as a namespace prefix. Not worth it. | ||
# So just download master and unpack it into src. | ||
.PHONY: src/cabin | ||
src/cabin: | ||
curl -Lso - https://github.com/jordansissel/go-cabin/tarball/master \ | ||
| tar -zvxf - --strip-components=1 '*'/src/cabin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"code.google.com/p/x-go-binding/xgb" | ||
"cabin" | ||
) | ||
|
||
func main() { | ||
logger := cabin.New() | ||
output := make(chan *cabin.Event) | ||
logger.Subscribe(output) | ||
go cabin.StdoutLogger(output) | ||
|
||
conn, err := xgb.Dial(os.Getenv("DISPLAY")) | ||
if err != nil { | ||
fmt.Printf("Failed to connect to the X Server (%s)\n", os.Getenv("DISPLAY")) | ||
os.Exit(1) | ||
} | ||
|
||
logger.Log("OK") | ||
logger.Log(conn) | ||
} |