Skip to content

Commit

Permalink
V2024.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Aug 5, 2024
1 parent d3fbd23 commit d78258d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2024.8.1
### Breaking Changes
None
### New APIs
None
### Fixes
#### System
- Improved `Nickvision::System::Process`'s handling of arguments

## 2024.8.0
### Breaking Changes
#### System
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

#libnick Definition
project ("libnick" LANGUAGES C CXX VERSION 2024.8.0 DESCRIPTION "A cross-platform base for native Nickvision applications.")
project ("libnick" LANGUAGES C CXX VERSION 2024.8.1 DESCRIPTION "A cross-platform base for native Nickvision applications.")
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
include(CTest)
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = "libnick"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "2024.8.0"
PROJECT_NUMBER = "2024.8.1"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
7 changes: 2 additions & 5 deletions manual/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@

libnick provides Nickvision apps with a common set of cross-platform APIs for managing system and desktop app functionality such as network management, taskbar icons, translations, app updates, and more.

## 2024.8.0
## 2024.8.1
### Breaking Changes
#### System
- `Nickvision::System::Process::kill()` will now kill child processes spawned by the respective process
None
### New APIs
None
### Fixes
#### Logging
- Cleaned up the message logged by `Nickvision::Logging::Logger:log()`
#### System
- Improved `Nickvision::System::Process`'s handling of arguments

Expand Down
5 changes: 3 additions & 2 deletions src/system/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ namespace Nickvision::System
{
return "";
}
std::vector<std::string> args{ StringHelpers::splitArgs(command) };
#ifdef _WIN32
Process process{ findDependency("cmd.exe"), { "/C", command } };
args.insert(args.begin(), "/c");
Process process{ findDependency("cmd.exe"), args };
#else
std::vector<std::string> args{ StringHelpers::splitArgs(command) };
std::string cmd{ args[0] };
args.erase(args.begin());
Process process{ cmd, args };
Expand Down
20 changes: 8 additions & 12 deletions src/system/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,27 @@ namespace Nickvision::System
throw std::runtime_error("Failed to create pipe.");
}
//Create process arguments
std::string appArgs{ "" };
for(size_t i = 0; i < m_args.size(); i++)
std::wstring appArgs{ L"\"" + m_path.wstring() + L"\"" };
for(const std::string& arg : m_args)
{
const std::string arg{ m_args[i] };
if(arg.find(' ') != std::string::npos && arg[0] != '\"')
{
appArgs += "\"" + arg + "\"";
appArgs += L" \"" + StringHelpers::wstr(arg) + L"\"";
}
else
{
appArgs += arg;
}
if(i != m_args.size() - 1)
{
appArgs += " ";
appArgs += L" " + StringHelpers::wstr(arg);
}
}
STARTUPINFOA si{ 0 };
si.cb = sizeof(STARTUPINFOA);
std::wcout << appArgs << std::endl;
STARTUPINFOW si{ 0 };
si.cb = sizeof(STARTUPINFOW);
si.hStdError = m_write;
si.hStdOutput = m_write;
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
si.wShowWindow = SW_HIDE;
//Create process
if(!CreateProcessA(m_path.string().c_str(), LPSTR(appArgs.c_str()), nullptr, nullptr, TRUE, CREATE_SUSPENDED | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP, nullptr, nullptr, &si, &m_pi))
if(!CreateProcessW(nullptr, appArgs.data(), nullptr, nullptr, TRUE, CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP, nullptr, nullptr, &si, &m_pi))
{
std::cerr << CodeHelpers::getLastSystemError() << std::endl;
CloseHandle(m_read);
Expand Down

0 comments on commit d78258d

Please sign in to comment.