Skip to content
Snippets Groups Projects
Commit 68b3ad91 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

do not ignore return value of the system call

parent 9ebbd3bb
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -18,7 +18,10 @@ namespace builtin {
std::vector < std::string> Dot::m_DotAllowedTypes { "dot", "xdot", "ps", "pdf", "svg", "svgz", "fig", "png", "gif", "jpg", "jpeg", "json", "imap", "cmapx" };
 
void Dot::dot ( const std::string & data ) {
( void ) std::system( ( "dot -Tx11 <<DOTDATA\n" + data + "\nDOTDATA" ).c_str ( ) );
int res = std::system( ( "dot -Tx11 <<DOTDATA\n" + data + "\nDOTDATA" ).c_str ( ) );
if ( res )
throw exception::CommonException ( "The dot command exited unsuccessfuly. Return value was " + ext::to_string ( res ) + "." );
}
 
void Dot::dot ( const std::string & data, const std::string & outputType, const std::string & outputFile ) {
......@@ -28,7 +31,10 @@ void Dot::dot ( const std::string & data, const std::string & outputType, const
if ( std::find ( m_DotAllowedTypes.begin( ), m_DotAllowedTypes.end ( ), outputType ) == m_DotAllowedTypes.end ( ) )
throw exception::CommonException ( "Dot outputType is invalid." );
 
( void ) std::system ( ( "dot -T" + outputTypeLower + " -o " + outputFile + "<<DOTDATA\n" + data + "\nDOTDATA" ).c_str ( ) );
int res = std::system ( ( "dot -T" + outputTypeLower + " -o " + outputFile + "<<DOTDATA\n" + data + "\nDOTDATA" ).c_str ( ) );
if ( res )
throw exception::CommonException ( "The dot command exited unsuccessfuly. Return value was " + ext::to_string ( res ) + "." );
}
 
auto DotTx11 = registration::AbstractRegister < Dot, void, const std::string & > ( Dot::dot, abstraction::AlgorithmCategories::AlgorithmCategory::DEFAULT, "dot_data" );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment