• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

icsm-au / DynAdjust / 13494567994

24 Feb 2025 09:15AM UTC coverage: 81.168% (+2.0%) from 79.161%
13494567994

push

github

web-flow
Merge pull request #234 from icsm-au/1.2.8

Version 1.2.8 (fixes, ehnacements, improved datum management)

6131 of 8137 new or added lines in 90 files covered. (75.35%)

162 existing lines in 33 files now uncovered.

32214 of 39688 relevant lines covered (81.17%)

11775.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/dynadjust/include/functions/dnaprocessfuncs.cpp
1
//============================================================================
2
// Name         : dnaprocessfuncs.cpp
3
// Author       : Roger Fraser
4
// Contributors :
5
// Version      : 1.00
6
// Copyright    : Copyright 2017 Geoscience Australia
7
//
8
//                Licensed under the Apache License, Version 2.0 (the "License");
9
//                you may not use this file except in compliance with the License.
10
//                You may obtain a copy of the License at
11
//               
12
//                http ://www.apache.org/licenses/LICENSE-2.0
13
//               
14
//                Unless required by applicable law or agreed to in writing, software
15
//                distributed under the License is distributed on an "AS IS" BASIS,
16
//                WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
//                See the License for the specific language governing permissions and
18
//                limitations under the License.
19
//
20
// Description  : Common process and fork functions
21
//============================================================================
22

23
#include <include/functions/dnaprocessfuncs.hpp>
24
#include <iostream>
25
#include <boost/process.hpp>
26

27
bool run_command(const std::string& executable_path, const UINT16& quiet)
32✔
28
{        
29
        // use boost's platform independent code to invoke a process
30
        // see https://www.boost.org/doc/libs/develop/doc/html/process.html
31
        //
32
        // An exit code of zero means the process was successful, 
33
        // while one different than zero indicates an error.
34

35
        
36
        // For windows batch files, add cmd to execute the batch file.
37
#if defined(_WIN32) || defined(__WIN32__)
38

39
        STARTUPINFO startup;
40
        PROCESS_INFORMATION process;
41

42
        memset(&startup, 0, sizeof(STARTUPINFO));
43
        memset(&process, 0, sizeof(PROCESS_INFORMATION));
44

45
        startup.cb = sizeof(STARTUPINFO);
46

47
        DWORD return_code(EXIT_SUCCESS);
48
        if (CreateProcess(0, (LPSTR)executable_path.c_str(), 0, 0, FALSE,
49
                0, 0, 0, &startup, &process))
50
        {
51
                WaitForSingleObject(process.hProcess, INFINITE);
52
                // Capture the return code
53
                GetExitCodeProcess(process.hProcess, &return_code);
54
                CloseHandle(process.hThread);
55
                CloseHandle(process.hProcess);
56

57
                return (return_code == EXIT_SUCCESS);
58
        }
59
        return EXIT_SUCCESS;
60

61
#elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__)                
62

63
        int return_value(0);
32✔
64

65
        try {        
32✔
66
                if (quiet)
32✔
NEW
67
                        return_value = boost::process::system(executable_path, boost::process::std_out > boost::process::null);
×
68
                else
69
                        return_value = boost::process::system(executable_path, boost::process::std_out > stdout);
37✔
70
                }
71
        catch (const boost::process::process_error& e)
5✔
72
        {
73
                std::cout << std::endl << "- Error: Cannot find " << executable_path << "\n" <<
5✔
74
                        "  " << e.what() << std::endl;
5✔
75
                return EXIT_FAILURE;
5✔
76
        }
5✔
77

78
        return (return_value == EXIT_SUCCESS);
27✔
79

80
#endif
81

82
        return EXIT_SUCCESS;
83
}
84

85

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc