On Wed, Feb 13, 2019 at 01:56:07AM -0500, Wesley Mouedine Assaby wrote: > Hi all, > > I'm using OpenBSD 6.4 amd64 (GENERIC.MP) #6 > > Using 'pkg_add' i can't access stdout, and the exit code stays 0 whatever it > finds or not the package to install. > > Example : > doas pkg_add sl > file.stdout > echo $? # exit code is 0 > cat file.stdout # empty file > > or > doas pkg_add sl > file.stdout 2>&1 > cat file.stdout # empty file > > Therefore, i can access stderr trying to install a bad package name but exit > code stays 0 > doas pkg_add sli > file.stderr > echo $? # exit code is 0 > cat file.stderr # => Can't find sli > > Reading pkg_add(1) : > Interactive mode is the default on a tty > -I Force non-interactive mode. Default is to be interactive when run from a > tty. > -i Force interactive mode, even if not run from a tty. pkg_add may ask > questions to the user if faced with difficult decisions. > > I also tried with -i/-I same issue. > > Any way to get stdout ? Is this an expected behavior ? > > Thanks, > > Wesley > hi,
I don't know about pkg_add return codes but what you are currently looking is the return code of doas which return >0 in those cases as explained in doas(1): • The config file /etc/doas.conf could not be parsed. • The user attempted to run a command which is not permitted. • The password was incorrect. • The specified command was not found or is not executable.

