summaryrefslogtreecommitdiff
path: root/scripts/_system_exec.lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-08-09 15:04:42 +0200
committerRobin Gareus <robin@gareus.org>2017-08-10 02:26:16 +0200
commit8fbc2c64842d5dc637dbe16e2d312545d1cff18b (patch)
tree9690d8c22003506a357212d3c4f1788719fd36f2 /scripts/_system_exec.lua
parente983e08f1d70bc872aa4c8cc11afb2c739e9981d (diff)
Add some more Lua script examples
Diffstat (limited to 'scripts/_system_exec.lua')
-rw-r--r--scripts/_system_exec.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/_system_exec.lua b/scripts/_system_exec.lua
new file mode 100644
index 0000000000..281f5dee0b
--- /dev/null
+++ b/scripts/_system_exec.lua
@@ -0,0 +1,20 @@
+ardour { ["type"] = "EditorAction", name = "System Exec" }
+
+function factory () return function ()
+ -- ** EXAMPLES TO RUN EXTERNAL APPLICATIONS ** --
+
+ -- run a command in a shell and wait for it to complete.
+ --
+ -- Details: basically just system(3), except on Unix like systems with
+ -- memory-locking, this call is special-cased to use vfork and close
+ -- file-descriptors. On other systems it defaults to Lua's os-library
+ -- built-in os.execute system() call.
+ os.execute ("date > /tmp/testdate")
+
+ -- os.forkexec() works as fire-and-forget. execv(3) style
+ --
+ -- Details: It calls vfork() and exec() under the hood, passing each
+ -- argument separately to exec (and needs a full-path to the binary).
+ os.forkexec ("/usr/bin/xterm")
+ os.forkexec ("/bin/sh", "-c", "import --frame \"/tmp/scr_$(date).png\"")
+end end