Skip to content

Commit

Permalink
removed useless PSIGTERM check on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
graph committed Jul 27, 2020
1 parent f80e67e commit a7ac34f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/cpp/subprocess/ProcessBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,6 @@ namespace subprocess {
} else if (signum == PSIGINT) {
// can I use pid for processgroupid?
success = GenerateConsoleCtrlEvent(CTRL_C_EVENT, pid);
} else if (signum == PSIGTERM) {
success = GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pid);
} else {
success = GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pid);
}
Expand Down
7 changes: 7 additions & 0 deletions src/cpp/subprocess/environ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ namespace subprocess {
EnvironSetter::EnvironSetter(const std::string& name) {
mName = name;
}
EnvironSetter::operator bool() const {
if (mName.empty())
return false;
const char* value = ::getenv(mName.c_str());
if (value == nullptr) return false;
return !!*value;
}
std::string EnvironSetter::to_string() {
const char *value = ::getenv(mName.c_str());
return value? value : "" ;
Expand Down
1 change: 1 addition & 0 deletions src/cpp/subprocess/environ.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace subprocess {
public:
EnvironSetter(const std::string& name);
operator std::string() { return to_string(); }
explicit operator bool() const;
std::string to_string();
EnvironSetter &operator=(const std::string &str);
EnvironSetter &operator=(const char* str);
Expand Down

0 comments on commit a7ac34f

Please sign in to comment.