[libcalamares] Avoid parameter name 'stdin'

This commit is contained in:
Adriaan de Groot 2022-02-07 12:54:16 +01:00
parent ebdcb15703
commit 932ab17c9a
2 changed files with 29 additions and 29 deletions

View File

@ -61,12 +61,12 @@ bp_list_to_qstringlist( const bp::list& args )
} }
static inline CalamaresUtils::ProcessResult static inline CalamaresUtils::ProcessResult
target_env_command( const QStringList& args, const std::string& stdin, int timeout ) target_env_command( const QStringList& args, const std::string& input, int timeout )
{ {
// Since Python doesn't give us the type system for distinguishing // Since Python doesn't give us the type system for distinguishing
// seconds from other integral types, massage to seconds here. // seconds from other integral types, massage to seconds here.
return CalamaresUtils::System::instance()->targetEnvCommand( return CalamaresUtils::System::instance()->targetEnvCommand(
args, QString(), QString::fromStdString( stdin ), std::chrono::seconds( timeout ) ); args, QString(), QString::fromStdString( input ), std::chrono::seconds( timeout ) );
} }
namespace CalamaresPython namespace CalamaresPython
@ -85,31 +85,31 @@ mount( const std::string& device_path,
} }
int int
target_env_call( const std::string& command, const std::string& stdin, int timeout ) target_env_call( const std::string& command, const std::string& input, int timeout )
{ {
return target_env_command( QStringList { QString::fromStdString( command ) }, stdin, timeout ).first; return target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout ).first;
} }
int int
target_env_call( const bp::list& args, const std::string& stdin, int timeout ) target_env_call( const bp::list& args, const std::string& input, int timeout )
{ {
return target_env_command( bp_list_to_qstringlist( args ), stdin, timeout ).first; return target_env_command( bp_list_to_qstringlist( args ), input, timeout ).first;
} }
int int
check_target_env_call( const std::string& command, const std::string& stdin, int timeout ) check_target_env_call( const std::string& command, const std::string& input, int timeout )
{ {
auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, stdin, timeout ); auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout );
return handle_check_target_env_call_error( ec, QString::fromStdString( command ) ); return handle_check_target_env_call_error( ec, QString::fromStdString( command ) );
} }
int int
check_target_env_call( const bp::list& args, const std::string& stdin, int timeout ) check_target_env_call( const bp::list& args, const std::string& input, int timeout )
{ {
auto ec = target_env_command( bp_list_to_qstringlist( args ), stdin, timeout ); auto ec = target_env_command( bp_list_to_qstringlist( args ), input, timeout );
if ( !ec.first ) if ( !ec.first )
{ {
return ec.first; return ec.first;
@ -121,19 +121,19 @@ check_target_env_call( const bp::list& args, const std::string& stdin, int timeo
std::string std::string
check_target_env_output( const std::string& command, const std::string& stdin, int timeout ) check_target_env_output( const std::string& command, const std::string& input, int timeout )
{ {
auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, stdin, timeout ); auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout );
handle_check_target_env_call_error( ec, QString::fromStdString( command ) ); handle_check_target_env_call_error( ec, QString::fromStdString( command ) );
return ec.second.toStdString(); return ec.second.toStdString();
} }
std::string std::string
check_target_env_output( const bp::list& args, const std::string& stdin, int timeout ) check_target_env_output( const bp::list& args, const std::string& input, int timeout )
{ {
QStringList list = bp_list_to_qstringlist( args ); QStringList list = bp_list_to_qstringlist( args );
auto ec = target_env_command( list, stdin, timeout ); auto ec = target_env_command( list, input, timeout );
handle_check_target_env_call_error( ec, list.join( ' ' ) ); handle_check_target_env_call_error( ec, list.join( ' ' ) );
return ec.second.toStdString(); return ec.second.toStdString();
} }
@ -201,7 +201,7 @@ static inline int
_process_output( Calamares::Utils::RunLocation location, _process_output( Calamares::Utils::RunLocation location,
const boost::python::list& args, const boost::python::list& args,
const boost::python::object& callback, const boost::python::object& callback,
const std::string& stdin, const std::string& input,
int timeout ) int timeout )
{ {
Calamares::Utils::Runner r( bp_list_to_qstringlist( args ) ); Calamares::Utils::Runner r( bp_list_to_qstringlist( args ) );
@ -222,9 +222,9 @@ _process_output( Calamares::Utils::RunLocation location,
} }
r.enableOutputProcessing(); r.enableOutputProcessing();
} }
if ( !stdin.empty() ) if ( !input.empty() )
{ {
r.setInput( QString::fromStdString( stdin ) ); r.setInput( QString::fromStdString( input ) );
} }
if ( timeout > 0 ) if ( timeout > 0 )
{ {
@ -243,19 +243,19 @@ _process_output( Calamares::Utils::RunLocation location,
int int
target_env_process_output( const boost::python::list& args, target_env_process_output( const boost::python::list& args,
const boost::python::object& callback, const boost::python::object& callback,
const std::string& stdin, const std::string& input,
int timeout ) int timeout )
{ {
return _process_output( Calamares::Utils::RunLocation::RunInTarget, args, callback, stdin, timeout ); return _process_output( Calamares::Utils::RunLocation::RunInTarget, args, callback, input, timeout );
} }
int int
host_env_process_output( const boost::python::list& args, host_env_process_output( const boost::python::list& args,
const boost::python::object& callback, const boost::python::object& callback,
const std::string& stdin, const std::string& input,
int timeout ) int timeout )
{ {
return _process_output( Calamares::Utils::RunLocation::RunInHost, args, callback, stdin, timeout ); return _process_output( Calamares::Utils::RunLocation::RunInHost, args, callback, input, timeout );
} }

View File

@ -28,28 +28,28 @@ int mount( const std::string& device_path,
const std::string& filesystem_name = std::string(), const std::string& filesystem_name = std::string(),
const std::string& options = std::string() ); const std::string& options = std::string() );
int target_env_call( const std::string& command, const std::string& stdin = std::string(), int timeout = 0 ); int target_env_call( const std::string& command, const std::string& input = std::string(), int timeout = 0 );
int target_env_call( const boost::python::list& args, const std::string& stdin = std::string(), int timeout = 0 ); int target_env_call( const boost::python::list& args, const std::string& input = std::string(), int timeout = 0 );
int check_target_env_call( const std::string& command, const std::string& stdin = std::string(), int timeout = 0 ); int check_target_env_call( const std::string& command, const std::string& input = std::string(), int timeout = 0 );
int check_target_env_call( const boost::python::list& args, const std::string& stdin = std::string(), int timeout = 0 ); int check_target_env_call( const boost::python::list& args, const std::string& input = std::string(), int timeout = 0 );
std::string std::string
check_target_env_output( const std::string& command, const std::string& stdin = std::string(), int timeout = 0 ); check_target_env_output( const std::string& command, const std::string& input = std::string(), int timeout = 0 );
std::string std::string
check_target_env_output( const boost::python::list& args, const std::string& stdin = std::string(), int timeout = 0 ); check_target_env_output( const boost::python::list& args, const std::string& input = std::string(), int timeout = 0 );
int target_env_process_output( const boost::python::list& args, int target_env_process_output( const boost::python::list& args,
const boost::python::object& callback = boost::python::object(), const boost::python::object& callback = boost::python::object(),
const std::string& stdin = std::string(), const std::string& input = std::string(),
int timeout = 0 ); int timeout = 0 );
int host_env_process_output( const boost::python::list& args, int host_env_process_output( const boost::python::list& args,
const boost::python::object& callback = boost::python::object(), const boost::python::object& callback = boost::python::object(),
const std::string& stdin = std::string(), const std::string& input = std::string(),
int timeout = 0 ); int timeout = 0 );
std::string obscure( const std::string& string ); std::string obscure( const std::string& string );