-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kernel.exec cannot launch two .bat files separated by && #809
Comments
I don't think there is anything we can do here. The error message is coming from Windows. If it is JVM, as you suspect, then I suggest filing a bug report with Oracle/OpenJDK. |
I tried this sample code on Java 1.7.0_11 and Java 1.7.0_21. From the JRuby, both of the batch files were executed on 1.7.0_11, The problem is that on 1.7.0_21 only the first batch file was executed. The sample code run from the Rakefile is: desc 'Run batch...' From a Java standpoint, both of the batch files were executed on 1.7.0_11 and 1.7.0_21 The sample code run from Java is: import java.util.; public class test {
} |
Ok, so the problem here is in how we handle running a command line that contains a && when on Windows. I believe we currently run such code by passing it to cmd /c. Perhaps you can do some investigation from there to see if there's a different way we should run this so it will execute as you expect? I do not personally have a Windows machine I can investigate this on. I'd also be interested in whether this works from C Ruby. |
The command can be simplified to "tbat.bat && tbattwo.bat" in the Ruby script and as already mentioned, in Java 1.7.0_11 it executes both batch files, whilst in Java 1.7.0_21 it only executes the first. As for C Ruby, I ran it on ruby 2.0.0p195 (2013-05-14) [i386-mingw32], and it executed both batch files. My guess is that Java made some changes in Runtime.exec (http://www.oracle.com/technetwork/java/javase/7u21-relnotes-1932873.html), could this be the source of the problem? |
On Thu, Jun 27, 2013 at 2:53 AM, mdeb notifications@github.com wrote:
That is a strong possibility. Nothing in our process launching logic Would it be possible for you to provide Java code that attempts to
|
The java code I used to launch the two batch files, the command line executed is simplified to "tbat.bat && tbattwo.bat", and this will execute both the batch files. import java.util.; public class test {
} |
Does this gist represent the issue? I ran that like this: ( (Windows 10 Enterprise 2016 LTSB. Version 1607. Os Build: 14393.2007. 64-bit.)
|
@olleolleolle So maybe this is no longer an issue? It has been sitting on the shelf for a long time. |
@headius For me, with the situation above, it worked. I think it's fair to close this issue. |
Given that Java 1.7.0_21 is installed, when running the system command, a command having the && operator to run another command, it gives the following error, "&& was unexpected at this time".
So for example:
C:\test.bat && C:\test.bat
"&& was unexpected at this time".
I reinstalled Java 1.7.0_11 and the problem was solved.
The text was updated successfully, but these errors were encountered: