Skip to content

Instantly share code, notes, and snippets.

@nddrylliog
Last active December 10, 2015 15:28
Show Gist options
  • Save nddrylliog/4454595 to your computer and use it in GitHub Desktop.
Save nddrylliog/4454595 to your computer and use it in GitHub Desktop.
Trying to launch processes and stuff.
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