mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 02:15:36 -04:00
[shellprocess] Implement timeout setting
- For both shellprocess and contextualprocess, add a top-level key "timeout" that defaults to 10 seconds (which it already did). - Allows setting "global" timeout for command-lists, while still allowing individual timeouts per-command. - Setting timeout per global variable in contextualprocess is not supported; that would restrict the possible space of comparisions, while not supporting a global setting timeout seems reasonable enough. Use instances if you need wildly variable timeouts and don't want to set them individually.
This commit is contained in:
parent
2da430fa36
commit
c2aca1f5c6
7 changed files with 31 additions and 16 deletions
|
@ -97,12 +97,15 @@ ContextualProcessJob::exec()
|
|||
void
|
||||
ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false );
|
||||
bool dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false );
|
||||
int timeout = CalamaresUtils::getInteger( configurationMap, "timeout", 10 );
|
||||
if ( timeout < 1 )
|
||||
timeout = 10;
|
||||
|
||||
for ( QVariantMap::const_iterator iter = configurationMap.cbegin(); iter != configurationMap.cend(); ++iter )
|
||||
{
|
||||
QString variableName = iter.key();
|
||||
if ( variableName.isEmpty() || ( variableName == "dontChroot" ) )
|
||||
if ( variableName.isEmpty() || ( variableName == "dontChroot" ) || ( variableName == "timeout" ) )
|
||||
continue;
|
||||
|
||||
if ( iter.value().type() != QVariant::Map )
|
||||
|
@ -121,7 +124,7 @@ ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
|||
continue;
|
||||
}
|
||||
|
||||
CalamaresUtils::CommandList* commands = new CalamaresUtils::CommandList( valueiter.value(), !m_dontChroot );
|
||||
CalamaresUtils::CommandList* commands = new CalamaresUtils::CommandList( valueiter.value(), !dontChroot, timeout );
|
||||
|
||||
if ( commands->count() > 0 )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue