]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vsh: Allow non-interactive use of 'cd' command
authorPeter Krempa <pkrempa@redhat.com>
Thu, 21 Mar 2024 13:46:29 +0000 (14:46 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Apr 2024 12:24:30 +0000 (14:24 +0200)
For testing purposes it will come handy to change the directory from a
batch-mode script. Remove the check forbidding use of the 'cd' command
in batch mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/manpages/virsh.rst
tools/vsh.c

index 37c63f59621ab5bbc950cc3024363160981588d6..fa038e4547fd83477f330109909128ebbdccac17 100644 (file)
@@ -326,8 +326,6 @@ Will change current directory to *directory*.  The default directory
 for the ``cd`` command is the home directory or, if there is no *HOME*
 variable in the environment, the root directory.
 
-This command is only available in interactive mode.
-
 
 pwd
 ---
index 7305160ed920216a7b8f8a50fc77a78f68a1745e..2805574ec63f228bfad07ed1803d354e5487ea77 100644 (file)
@@ -3207,11 +3207,6 @@ cmdCd(vshControl *ctl, const vshCmd *cmd)
     const char *dir = NULL;
     g_autofree char *dir_malloced = NULL;
 
-    if (!ctl->imode) {
-        vshError(ctl, "%s", _("cd: command valid only in interactive mode"));
-        return false;
-    }
-
     if (vshCommandOptStringQuiet(ctl, cmd, "dir", &dir) <= 0)
         dir = dir_malloced = virGetUserDirectory();
     if (!dir)