diff options
author | Richard Jones <rjones@trick.home.annexia.org> | 2009-06-22 07:49:50 +0100 |
---|---|---|
committer | Richard Jones <rjones@trick.home.annexia.org> | 2009-06-22 07:49:50 +0100 |
commit | 4211c7a258debd236017a19c70965bc1b3658edb (patch) | |
tree | 50372cfd72f49b84b753e2aa58c92dfc99b4586f /java/com | |
parent | 57d2dfab18ad3d987d9273bb7c1f42e73e0bbcb2 (diff) | |
download | libguestfs-4211c7a258debd236017a19c70965bc1b3658edb.tar.gz libguestfs-4211c7a258debd236017a19c70965bc1b3658edb.tar.xz libguestfs-4211c7a258debd236017a19c70965bc1b3658edb.zip |
Generated code for 'sh' and 'sh-lines' commands.
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/redhat/et/libguestfs/GuestFS.java | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java index d29ae54f..40754204 100644 --- a/java/com/redhat/et/libguestfs/GuestFS.java +++ b/java/com/redhat/et/libguestfs/GuestFS.java @@ -1998,7 +1998,9 @@ public HashMap<String,String> test0rhashtableerr () * The single parameter is an argv-style list of arguments. * The first element is the name of the program to run. * Subsequent elements are parameters. The list must be - * non-empty (ie. must contain a program name). + * non-empty (ie. must contain a program name). Note that + * the command runs directly, and is *not* invoked via the + * shell (see "g.sh"). * <p> * The return value is anything printed to *stdout* by the * command. @@ -2040,6 +2042,8 @@ public HashMap<String,String> test0rhashtableerr () * This is the same as "g.command", but splits the result * into a list of lines. * <p> + * See also: "g.sh_lines" + * <p> * Because of the message protocol, there is a transfer * limit of somewhere between 2MB and 4MB. To transfer * large files you should use FTP. @@ -3383,4 +3387,52 @@ public HashMap<String,String> test0rhashtableerr () private native int _ntfs_3g_probe (long g, boolean rw, String device) throws LibGuestFSException; + /** + * run a command via the shell + * <p> + * This call runs a command from the guest filesystem via + * the guest's "/bin/sh". + * <p> + * This is like "g.command", but passes the command to: + * <p> + * /bin/sh -c "command" + * <p> + * Depending on the guest's shell, this usually results in + * wildcards being expanded, shell expressions being + * interpolated and so on. + * <p> + * All the provisos about "g.command" apply to this call. + * <p> + * @throws LibGuestFSException + */ + public String sh (String command) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("sh: handle is closed"); + return _sh (g, command); + } + private native String _sh (long g, String command) + throws LibGuestFSException; + + /** + * run a command via the shell returning lines + * <p> + * This is the same as "g.sh", but splits the result into a + * list of lines. + * <p> + * See also: "g.command_lines" + * <p> + * @throws LibGuestFSException + */ + public String[] sh_lines (String command) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("sh_lines: handle is closed"); + return _sh_lines (g, command); + } + private native String[] _sh_lines (long g, String command) + throws LibGuestFSException; + } |