xcopy via os-command weirdness

Posted by Grant Holman on 19-Jan-2017 05:44

Can anyone explain this.

The command OS-COMMAND SILENT VALUE("xcopy c:\a.txt d:\ /Y")  will do nothing if there is an OUTPUT TO "somefile" before it (this could also be a named stream - e.g.  OUTPUT STREAM st1 TO "somefile").  However, if no outputs then xcopy works ok.

What is going on here!?

Notes:

Adding OUTPUT TO TERMINAL immediately before the xcopy and it works, irrespective of how many other streams are already redirecting to files.

The xcopy command is fine in itself - tested thoroughly.

OS-COMMAND SILENT VALUE("copy c:\a.txt d:\ /Y") works fine always.

No prior 'OUTPUT TO' then xcopy works fine.

I've replicated this issue in 9.1D and 11.6.

All Replies

Posted by Brian K. Maher on 19-Jan-2017 05:52

Hi Grant,
 
This is a bug.  It was initially reported against 10.2B and 11.2.  The bug number is 00259958.  At this moment the bug has not been fixed so if you need this resolved  please open a support case so we can go through the process of getting it fixed and patched for you.
 
Brian Maher
 

Posted by Brian K. Maher on 19-Jan-2017 05:56

Hi Grant,
 
There is a KB article on this and it does state that modifying the command string *may* resolve the problem in some cases.  For your particular case, I would try this:
 
OS-COMMAND SILENT VALUE(“cmd.exe /c xcopy c:\a.txt d:\ /Y”).
 
Brian Maher

Posted by Grant Holman on 19-Jan-2017 10:01

Hello Brian

Many thanks for your replies.  I had tried 'cmd /c' already without success.  However doing this makes it work:

OUTPUT TO TERMINAL.

OS-COMMAND SILENT VALUE("xcopy c:\a.txt d:\ /Y")

OUTPUT CLOSE.

No idea why, but happy just to get it working :-)

Posted by Brian K. Maher on 19-Jan-2017 10:26

Hi Grant,
 
I’m glad to know you have a workaround.  I would suggest that if that workaround is in any unacceptable for you that you go ahead and open a support case so we can see about getting it fixed.
 
Brian

Posted by Ken Ward on 19-Jan-2017 10:50

I was having a similar issue last month with OS-COMMAND. I was executing MOVE and DIR commands in batch mode when all of a sudden the process would just seem to hang. There would be a cmd.exe process that I couldn't get rid of without rebooting the server.

Since this was in 11.2 I used some .Net Methods to do the commands:

System.IO.Directory:GetFiles(path AS CHAR) RETURNS CLASS "System.String[]" for DIR.

System.IO.File:Move(source AS CHAR, dest AS CHAR ) for MOVE.

This seemed to do the trick though the customer claimed it was slower.

Not sure if there's an equivalent to xcopy though...

I'd love to know if this logged bug is related to my issue at all because I couldn't find any reason for it.

Posted by Brian K. Maher on 19-Jan-2017 11:00

Hi Ken,
 
I’m not sure if there is a way to tell if what you ran into is the same issue.  There hasn’t been enough analysis of this bug to know the cause.
 
Brian

Posted by Stefan Marquardt on 20-Jan-2017 09:21

Hi Brian,

we had problems with I/O commands too (case 00319009 and 00287906)

Started with 10.2B and without any change of code it stopped working.

Our error was to change the OE version and windows version and the nightmare began.

Our workaround was to use "start /w ..." at the beginning and then the orginal command.

Stefan

Posted by Alon Blich on 20-Jan-2017 09:23

Hi,

Another option is to put the command(s) in a batch file and run the batch file.

HTH

Posted by Adriano Correa on 23-Jan-2017 11:26

Stefan, I got the same issue.

In some situation I had to start or stop some databases. The command to stop worked fine ("_mprshut db -by"). But to start the database, I had to use "start _mprosrv etc", or the prowin32 just freeze.

Posted by Stefan Marquardt on 24-Jan-2017 00:19

Adriano,

you described exact our problem - the problem.

We had many open cases (for years) but finally we solved it ourselves with adding "start".

Since today nobody was able to identify the cause why the process_mprosrv is blocked and all clients (prowin, promon) freezes without using start.

But until today we have sporadic problems after reboot, we are on 11.6.3.

Stefan

Posted by Alon Blich on 24-Jan-2017 03:27

i've never ran into any issues since i've moved to using batch files YMMV

for example, the baksys project in the standard libraries at oehive.org makes extensive calls to openedge command line tools using the same approach.

This thread is closed