From eb82c632e3b39cf53c2df000020973ea77edbb83 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 21 Mar 2024 14:46:29 +0100 Subject: [PATCH] vsh: Allow non-interactive use of 'cd' command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- docs/manpages/virsh.rst | 2 -- tools/vsh.c | 5 ----- 2 files changed, 7 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 37c63f5962..fa038e4547 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -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 --- diff --git a/tools/vsh.c b/tools/vsh.c index 7305160ed9..2805574ec6 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -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)