Skip to content

Commit 00ed4ea

Browse files
committed
Fixed parameters order for ra::process::StartProcess() calls.
Fixed detection of failed process startup using `ra::process::INVALID_PROCESS_ID` instead of value 0.
1 parent ec350f8 commit 00ed4ea

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/ActionExecute.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ namespace shellanything
5353
std::string arguments = pmgr.expand(mArguments);
5454

5555
bool basedir_missing = basedir.empty();
56+
bool arguments_missing = arguments.empty();
5657

5758
//Note: the startProcess() function requires basedir to be valid.
5859
//If not specified try to fill basedir with the best option available
@@ -94,11 +95,19 @@ namespace shellanything
9495
}
9596

9697
//debug
97-
LOG(INFO) << "Running '" << path << "' from directory '" << basedir << "' with arguments '" << arguments << "'";
98-
99-
uint32_t pId = ra::process::StartProcess(path, arguments, basedir);
98+
uint32_t pId = ra::process::INVALID_PROCESS_ID;
99+
if (arguments_missing)
100+
{
101+
LOG(INFO) << "Running '" << path << "' from directory '" << basedir << "'";
102+
pId = ra::process::StartProcess(path, basedir);
103+
}
104+
else
105+
{
106+
LOG(INFO) << "Running '" << path << "' from directory '" << basedir << "' with arguments '" << arguments << "'";
107+
pId = ra::process::StartProcess(path, basedir, arguments);
108+
}
100109

101-
bool success = pId != 0;
110+
bool success = pId != ra::process::INVALID_PROCESS_ID;
102111
if (success)
103112
{
104113
LOG(INFO) << "Process created. PID=" << pId;

0 commit comments

Comments
 (0)