Skip to content

Commit

Permalink
fix tc_port forExec exception info
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanshudong committed Mar 1, 2024
1 parent 3f85df1 commit b1dde86
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions util/src/tc_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,9 +781,7 @@ int64_t TC_Port::forkExec(const string& sExePath, const string& sPwdPath, const
&pi // 接收新进程的识别信息的PROCESS_INFORMATION结构体
))
{
string err = TC_Exception::parseError(TC_Exception::getSystemCode());

throw TC_Port_Exception("[TC_Port::forkExec] CreateProcessA exception:" + err);
throw TC_Port_Exception("[TC_Port::forkExec] CreateProcessA exception:" + TC_Exception::getSystemError());
}

CloseHandle(pi.hThread);
Expand All @@ -796,10 +794,7 @@ int64_t TC_Port::forkExec(const string& sExePath, const string& sPwdPath, const
string bin = sExePath;
if(!TC_File::isAbsolute(bin))
{
char current_directory[FILENAME_MAX] = {0x00};
getcwd(current_directory, sizeof(current_directory));

bin = TC_File::simplifyDirectory(string(current_directory) + FILE_SEP + bin);
bin = TC_File::simplifyDirectory(TC_Port::getCwd() + FILE_SEP + bin);
}

vector<string> vArgs;
Expand All @@ -820,7 +815,7 @@ int64_t TC_Port::forkExec(const string& sExePath, const string& sPwdPath, const
pid_t pid = fork();
if (pid == -1)
{
throw TC_Port_Exception("[TC_Port::forkExec] fork exception");
throw TC_Port_Exception("[TC_Port::forkExec] fork error:" + TC_Exception::getSystemError());
}

if (pid == 0)
Expand Down

0 comments on commit b1dde86

Please sign in to comment.