cnf: Only search for packages when shell is interactive
If we're inside a script, we can't ask a user to install a package, so just return with an error. Example: $ banshee -bash: banshee: command not found Install package 'banshee' to provide command 'banshee'? [N/y] $ bash -c '. /etc/profile.d/PackageKit.sh; banshee' bash: banshee: command not found Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
parent
b8f5de2e0c
commit
a13d6535a6
@ -10,6 +10,9 @@ command_not_found_handle () {
|
||||
local runcnf=1
|
||||
local retval=127
|
||||
|
||||
# only search for the command if we're interactive
|
||||
[[ $- =~ i ]] || runcnf=0
|
||||
|
||||
# don't run if DBus isn't running
|
||||
[ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user