This is the mail archive of the
mailing list for the Cygwin project.
Different behaviour of "test -f" under cmd and bash, when called from compiled App
- From: "Luis Torres" <torres2003 at sapo dot pt>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Tue, 09 Dec 2003 22:31:52 +0000
- Subject: Different behaviour of "test -f" under cmd and bash, when called from compiled App
- Reply-to: "Luis Torres" <torres2003 at sapo dot pt>
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 ");
fprintf(stderr,"Executing %s\n", command);
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: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html