Walker test code coverage report
Current view: top level - Base - ProcessControl.cpp (source / functions) Hit Total Coverage
Commit: test_coverage.info Lines: 9 10 90.0 %
Date: 2022-09-21 18:57:21 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 14 26 53.8 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Base/ProcessControl.cpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.
       7                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     POSIX process control wrapper definitions
       9                 :            :   \details   POSIX process control wrapper definitions.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include <string>
      14                 :            : #include <vector>
      15                 :            : #include <istream>
      16                 :            : #include <type_traits>
      17                 :            : 
      18                 :            : #include "NoWarning/pstream.hpp"
      19                 :            : 
      20                 :            : #include "ProcessControl.hpp"
      21                 :            : #include "Exception.hpp"
      22                 :            : 
      23                 :            : namespace tk {
      24                 :            : 
      25                 :            : // *****************************************************************************
      26                 :            : //  Remove file from file system
      27                 :            : //! \param[in] file File name to delete (shell wildcards NOT expanded)
      28                 :            : //! \details Since we use pstream's basic_ipstream constructor with signature
      29                 :            : //!   ( const std::string & file, const argv_type & argv, pmode mode = pstdout )
      30                 :            : //!   and the file argument doesn't contain a slash, the actions of the shell
      31                 :            : //!   are duplicated in searching for an executable in PATH. The shell will not
      32                 :            : //!   interpret the other arguments, so wildcard expansion will not take place.
      33                 :            : // *****************************************************************************
      34                 :          1 : void rm( const std::string& file ) {
      35                 :          2 :   std::vector< std::string > argv;
      36 [ +  - ][ +  - ]:          1 :   argv.push_back( "rm" );
      37         [ +  - ]:          1 :   argv.push_back( file );
      38 [ +  - ][ +  - ]:          3 :   redi::ipstream in( "rm", argv, redi::pstreambuf::pstderr );
      39                 :          2 :   std::string e;
      40                 :          2 :   std::string error;
      41 [ +  - ][ +  - ]:          2 :   while ( std::getline( in, e ) ) error += e + '\n';
         [ +  + ][ +  - ]
                 [ +  - ]
      42 [ +  - ][ +  - ]:          1 :   if (!error.empty()) Throw( std::move(error) );
                 [ +  - ]
      43                 :          0 : }
      44                 :            : 
      45                 :            : } // tk::

Generated by: LCOV version 1.14