Executing a system command in Vala

I would like to execute a command (e.g. ls) in Vala, like the os.system Python function, or better, the popen function. Any idea?

+6
function command system vala
source share
2 answers

It is best to use the posix package. Then just Posix.system("command") , which returns an int.

http://www.valadoc.org/posix/Posix.system.html

+9
source share

OK, it turned out: Glib.Process.spawn_command_line_sync.

+14
source share

All Articles