RunProcess, parameters and NOW bug
Posted: Thu Feb 13, 2020 3:12 pm
Have found what I consider a bug when passing parameters to a subprocess called by RunProcess. If one is passing a variable initialized by NOW or passing NOW directly to the parameter (see below for an example), the value used in the subprocess is a number, but is not the actual value of NOW in the calling process.
In these two example, no matter what the interval is between the start and end, pnStart and pnEnd will be identical and also about 20 minutes in the past if converted to display time. And if you think that is weird, let's say the master process is executed at, say 10:35 am, so the pnStart/pnEnd in the process evaluate to 10:15 am. For the rest of the day, no matter how many times the master process is executed, pnStart/pnEnd will evaluate to 10:15 am.
Now, this is easy enough to work around; just wondered if anyone else has seen this or similar issues with other functions and RunProcess. We have not seen any other parameter processing issues, but have only tested RAND. We also tested multiplying NOW by one which led to a time about 1.5 hours in the future. Multiplying NOW by two resulted in the process reporting that it completed about 20 years ago.
So, armed with this knowledge, we can provide finance departments with the ability to complete their work years ago.
We did a good bit of testing. For now, just going to convert the NOW results to a string and pass that to the sub.
Code: Select all
tStart = NOW;
#...
# Do something in other process code
#...
tEnd = NOW;
RunProcess('ProcessCaptureStats',
'pnStart', tStart,
'pnEnd', tEnd);
# OR
RunProcess('ProcessCaptureStats',
'pnStart', tStart,
'pnEnd', NOW);
Now, this is easy enough to work around; just wondered if anyone else has seen this or similar issues with other functions and RunProcess. We have not seen any other parameter processing issues, but have only tested RAND. We also tested multiplying NOW by one which led to a time about 1.5 hours in the future. Multiplying NOW by two resulted in the process reporting that it completed about 20 years ago.


We did a good bit of testing. For now, just going to convert the NOW results to a string and pass that to the sub.