Fix bug 60966

Add timeouts & update README
This commit is contained in:
Alexey
2023-02-08 20:18:21 +03:00
parent f5c4dab90b
commit 7d6a29d063
2 changed files with 8 additions and 7 deletions

View File

@ -51,8 +51,8 @@ You need to create an xml configuration file. It must contain:
# (non-required) default unicode code delimiter for csv files, if filenameCsvTxtParams is 0, or no param in filename (default - 3b)
<defaultCsvDelimiter> </defaultCsvDelimiter>
# (non-required) timeout in seconds (default - 300 (5 min))
<timeout> <timeout>
# (non-required) timeout in seconds (default - 300). Set to 0 to disable timeouts
<timeout> </timeout>
# (non-required) path to xml file with a list of input files
<inputFilesList> </inputFilesList>
@ -94,6 +94,7 @@ You can use the following templates:
<errorsOnly> </errorsOnly>
<deleteOk> </deleteOk>
<timestamp> </timestamp>
<timeout> </timeout>
<fonts system="">
<directory> </directory>
</fonts>

View File

@ -45,7 +45,7 @@
namespace NSX2T
{
int Convert(const std::wstring& sConverterDirectory, const std::wstring sXmlPath, unsigned long nTimeout = 0, bool *bOutWaitResult = nullptr)
int Convert(const std::wstring& sConverterDirectory, const std::wstring sXmlPath, unsigned long nTimeout = 0, bool *bOutIsTimeout = nullptr)
{
int nReturnCode = 0;
std::wstring sConverterExe = sConverterDirectory + L"/x2t";
@ -100,8 +100,8 @@ namespace NSX2T
DWORD nWaitResult = WaitForSingleObject(processinfo.hProcess, nTimeout * 1000);
// true if timeout
if(bOutWaitResult != nullptr)
*bOutWaitResult = (bool)nWaitResult;
if(bOutIsTimeout != nullptr)
*bOutIsTimeout = (WAIT_TIMEOUT == nWaitResult);
RELEASEARRAYOBJECTS(pCommandLine);
@ -183,8 +183,8 @@ namespace NSX2T
while (-1 == waitpid(pid, &status, 0));
if(WIFSIGNALED(status))
{
if(bOutWaitResult != nullptr && WTERMSIG(status) == SIGXCPU)
*bOutWaitResult = true;
if(bOutIsTimeout != nullptr && WTERMSIG(status) == SIGXCPU)
*bOutIsTimeout = true;
nReturnCode = status;
}
else if (WIFEXITED(status))