Different behaviour of "test -f" under cmd and bash, when called from compiled App

Luis Torres torres2003@sapo.pt
Tue Dec 9 22:51:00 GMT 2003


Hello,

While experiencing difficulties running a Java applicaton that calls shell + C processes, compiled using
Cygwin tools I posed or perhaps ill-posed a question regarding the use of Java. I think I might eventually
solve my particular problem if I understand 2 points, which I think this m-l may help clarify:

1) I would like to know if this is true:
  A process (*.exe file using dynamic libraries or not, compiled using gcc ) and called from Java will behave
 properly as long as that process called from the cmd.exe shell in W2K also works OK. That is I assume that the
 Java Virtual machine when processing something like this
                   Runtime.getRuntime().exec("cmd /c myprocess.exe "); 
                   will not generate  java.io.IOException: CreateProcess: error=2,3

2)  In relation to the above I tracked the following problem. If I use (interactive shell):
      test -f AfileIKnowExists && echo YES (under either cmd.exe or Cygwin/bash), I get the correct answer
       (test.exe  from /cygdrive/c/cygwin/bin as per official distribution)
      while if I use the code bellow within a program.exe compiled under Cygwin, I get the correct answer if
         I use it within bash but NOT the correct answer if I use the program in cmd.exe
   
     Code : "
          strcpy(command,"test -f ");
  strcat(command,fpath);
  if(verbose)
    fprintf(stderr,"Executing %s\n", command);
  if(!system(command))
    return 1;
  else
    return 0;
    "      
the path, by the way is: /cygdrive/c/BHPViewer/demo/data/proj1/seismic/taranaki_frac_0000.HDR.
/cygdrive/c/ replaced by c:/ gives same results in all cases.
         
Is this normal?. What is the possible reason?. How to fix?. Could it be  a <CR/LF> problem?. I used Unix-style
in the install which is much better for exchanging files with other Unix machines.

Thank you for your help.

Regards,

Luis






--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list