diff --git a/alib2cli/src/builtin/Dot.cpp b/alib2cli/src/builtin/Dot.cpp index 9876c5b8193f3da7c80c44781ec33759980c3080..6ac6d7eec58283d5c6f605f7e1ee71ee9f90a908 100644 --- a/alib2cli/src/builtin/Dot.cpp +++ b/alib2cli/src/builtin/Dot.cpp @@ -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" );