Hi Lennart, Thanks for your review and response... On Thu, May 24, 2018 at 12:20:36PM +0200, Lennart Poettering wrote: > On Do, 24.05.18 13:47, Lee, Chun-Yi (joeyli.kernel at gmail.com) wrote: > > > Currently the systemd-detect-virt returns exit failure code when it > > detected none state. But actually the none state is still a valid > > state but not a process failed. > > > > This patch changes the logic to return success code when the state > > is none. It can avoid that subsequent activity is blocked by the > > failure code of systemd-detect-virt process. > > This is supposed to be used in shell script constructs like the > following: > > <snip> > if systemd-detect-virt -q ; then > echo "Detected virtualization" > else > echo "Detected no virtualization" > fi > </snip> > > That exit code hence is used as boolean indication whether > virtualization is available or not. And this behaviour is explicitly > documented in the man page. It's API and for a good reason so. Even if > we could break API just like that we really shouldn't because such if > constructs make a ton of sense and are generally how shell does this, > see the "test" command for example. > > Sorry, but you need to find a different way to do what you are trying > to do... > > Sorry, > hm.... I avoid writing script by "RUN+=" in the rule. Do you have good idea to inhibit the exit failure to avoid the subsequent activity be blocked? Or, can we add a new option to systemd-detect-virt to inhibit the exit failure code when the state is none? Thanks a lot! Joey Lee