From: Nadav Har'El <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master

cli: add "run" command

Our cli lacks a direct command run an arbitrary executable in the image,
and indirect way we do have doesn't know how to take parameters (see
issue #679).

So in this patch, we add a simple new "run" command. It can be used
as in this example:

   run "java.so -version"

Signed-off-by: Nadav Har'El <[email protected]>
Message-Id: <[email protected]>

---
diff --git a/modules/cli/commands/run.lua b/modules/cli/commands/run.lua
--- a/modules/cli/commands/run.lua
+++ b/modules/cli/commands/run.lua
@@ -0,0 +1,23 @@
+local OptionParser = require('std.optparse')
+
+local cmd = {}
+
+cmd.desc = [[run an executable in the background]]
+
+cmd.parser = OptionParser [[
+run - run an executable in the background
+
+Usage: run "command.so args..." ...
+]]
+
+cmd.main = function(args)
+  local args, opts = cmd.parser:parse(args)
+
+  for i = 1, #args do
+    osv_request({"app"}, "PUT", {
+      command = args[i]
+    })
+  end
+end
+
+return cmd

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to