Add --cmdline arg; rework wibo subprocess spawn

This commit is contained in:
2025-09-29 22:05:33 -06:00
parent 9dd65bc70a
commit 7f9d141a20
6 changed files with 144 additions and 98 deletions

View File

@@ -2688,16 +2688,10 @@ namespace msvcrt {
DEBUG_LOG("_wspawnvp(%d, %s)\n", mode, command.c_str());
std::vector<std::string> argStorage;
argStorage.emplace_back(command);
for (const uint16_t *const *cursor = argv; *cursor; ++cursor) {
argStorage.emplace_back(wideStringToString(*cursor));
}
if (argStorage.empty()) {
argStorage.emplace_back(command);
}
DEBUG_LOG("-> argv:");
for (const auto &arg : argStorage) {
DEBUG_LOG(" '%s'", arg.c_str());
}
auto resolved = processes::resolveExecutable(command, false);
if (!resolved) {
@@ -2708,10 +2702,10 @@ namespace msvcrt {
DEBUG_LOG("-> resolved to %s\n", resolved->c_str());
pid_t pid = -1;
int spawnResult = processes::spawnViaWibo(*resolved, argStorage, &pid);
int spawnResult = processes::spawnWithArgv(*resolved, argStorage, &pid);
if (spawnResult != 0) {
errno = spawnResult;
DEBUG_LOG("-> spawnViaWibo failed: %d\n", spawnResult);
DEBUG_LOG("-> spawnWithArgv failed: %d\n", spawnResult);
return -1;
}
DEBUG_LOG("-> spawned pid %d\n", pid);
@@ -2752,16 +2746,10 @@ namespace msvcrt {
DEBUG_LOG("_spawnvp(%d, %s)\n", mode, command.c_str());
std::vector<std::string> argStorage;
argStorage.emplace_back(command);
for (const char * const *cursor = argv; *cursor; ++cursor) {
argStorage.emplace_back(*cursor);
}
if (argStorage.empty()) {
argStorage.emplace_back(command);
}
DEBUG_LOG("-> argv:");
for (const auto &arg : argStorage) {
DEBUG_LOG(" '%s'", arg.c_str());
}
auto resolved = processes::resolveExecutable(command, false);
if (!resolved) {
@@ -2772,10 +2760,10 @@ namespace msvcrt {
DEBUG_LOG("-> resolved to %s\n", resolved->c_str());
pid_t pid = -1;
int spawnResult = processes::spawnViaWibo(*resolved, argStorage, &pid);
int spawnResult = processes::spawnWithArgv(*resolved, argStorage, &pid);
if (spawnResult != 0) {
errno = spawnResult;
DEBUG_LOG("-> spawnViaWibo failed: %d\n", spawnResult);
DEBUG_LOG("-> spawnWithArgv failed: %d\n", spawnResult);
return -1;
}
DEBUG_LOG("-> spawned pid %d\n", pid);