Last active
December 10, 2015 15:28
-
-
Save nddrylliog/4454595 to your computer and use it in GitHub Desktop.
Trying to launch processes and stuff.
This file contains hidden or 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
import os/[ShellUtils, Process], structs/ArrayList, io/File | |
main: func { | |
exec := func (p: Process) { | |
(output, exitCode) := p getOutput() | |
"Exit code: %d" printfln(exitCode) | |
if (exitCode == 0) { | |
output println() | |
} | |
} | |
{ | |
"== sdl2, Try 1 ==" println() | |
p := Process new([ShellUtils findExecutable("sdl2-config", true) getPath(), "--cflags"]) | |
try { | |
exec(p) | |
} catch (pe: ProcessException) { | |
"Got a process exception!" println() | |
} | |
} | |
{ | |
"== sdl2, Try 2 ==" println() | |
p := Process new(["sh", "sdl2-config --cflags"]) | |
exec(p) | |
} | |
{ | |
"== sdl, Try 1 ==" println() | |
p := Process new([ShellUtils findExecutable("pkg-config", true) getPath(), "sdl", "--cflags"]) | |
exec(p) | |
} | |
{ | |
"== sdl, Try 2 ==" println() | |
p := Process new(["sh", "pkg-config", "sdl", "--cflags"]) | |
exec(p) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment