Open mlandres opened 3 years ago
Why wait?
Because most often just some updater applet PK, purge-kernel, YAAST or zypper is about to finish their action. Using zypper in shell scripts may also benefit from a small timeout, waiting for an other background action to finish rather than failing immediately with ZYPPER_EXIT_ZYPP_LOCKED(7).
And you know that whatever time is designated as a timeout shall be adequate? It must be. I am almost certain that there is a superior way to remediate of this problem; are you unable to ascertain programmatically whether a relevant process is operative? "http://src.fedoraproject.org/rpms/konsole" is able to: it notifies me when any process that I have invoked via it ceases to operate.
And you know that whatever time is designated as a timeout shall be adequate? It must be. I am almost certain that there is a superior way to remediate of this problem; are you unable to ascertain programmatically whether a relevant process is operative? "http://invent.kde.org/utilities/konsole" is able to: it notifies me when a process (that I have invoked via it) ceases to operate.
You'd need to know exactly what process is blocking. This could maybe be implemented using a pid file and then waiting for the process to exit, not sure atm if its possible to wait on a process that was started externally or just for those that are part of your process group. But we are currently working on a bigger refactoring in the libzypp library, however we are open for contributions :)
Basically the behavior can be achieved by setting
$ZYPP_LOCK_TIMEOUT
to the number of seconds to wait for the zypp lock. Waiting is handled inside libzypp. Just a way to provide visual feedback to the user is missing.