This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 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 ");
    fprintf(stderr,"Executing %s\n", command);
    return 1;
    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.



Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]