-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Weird behavior: os.execute #19410
Comments
What is |
The
public class Foo {
public static class Bar {
public static void baz(){
System.out.print("+1");
}
}
} |
Ok... I created import os
java_cmd := 'javac Foo.java'
_ := os.execute(java_cmd) Then I did When that completed, I had this:
So... looks like it's working, to me. |
OK. Sorry for the inconvenience. I tried that on my end and it works too, but as soon I implement it on the code itself it doesn't work, but no problem. Thanks non the less. |
What do you mean "implement it on the code itself"? Can you show an example that fails? |
I could but I would look more stupid. This is just one of those cases... // 1. Cleanup old .class files that don't exist in .java form.
for built_source in os.walk_ext(jake.build_dir_path, 'class') {
src := built_source.replace('.class', '.java').replace(jake.build_dir_path, jake.src_dir_path)
if !os.exists(src) {
os.rm(built_source) or {
eprintln("Couldn't remove old .class file ${built_source}. ERR: ${err}")
exit(1)
}
}
} I was trying to clean up old
Sorry again for the time spent on a foolish error. I was really convinced that this was a weird bug. Have a good weekend and thanks for the help. |
No worries - we've all been there once or twice (ahem!). :-) |
Describe the bug
Brief Explanation about Javac:
When trying to compile java files with inner classes, the
javac
will generate:THE bug:
This bug happen while trying to compile java source files with inner classes, but for some reason the inner class files wouldn't generate. (Bar class in the example above)
After looking at the V code I found that under the hood
os.execute
uses:So I created a simple program in C using the same funcs and for some reason, everthing worked fine. So I tried exiting the program after the
os.execute
to check if the main process wouldjavac
end the job and it worked.The above example works fine, but if we remove the
panic
call, the java compiler doesn't generate all the files, making me think that the process doesn't wait until the child process ends to close it.Reproduction Steps
Expected Behavior
os.execute
should work the same as 'sh [cmd]`Current Behavior
os.execute
doesn't work as 'sh [cmd]`Possible Solution
No response
Additional Information/Context
No response
V version
0.4.1
Environment details (OS name and version, etc.)
V full version: V 0.4.1 a0490f2
OS: linux, Linux version 6.5.3-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Wed, 13 Sep 2023 08:37:40 +0000
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
getwd: /home/marco/dev/open23/jake/example
vexe: /home/marco/dev/soft/v/v
vexe mtime: 2023-09-12 20:09:47
vroot: OK, value: /home/marco/dev/soft/v
VMODULES: OK, value: /home/marco/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.42.0
Git vroot status: 0.4.1-61-ga0490f2b (50 commit(s) behind V master)
.git/config present: true
CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
Important
You can vote for this issue using the 👍 reaction. More votes increase the issue's priority
for developers.
Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.
The text was updated successfully, but these errors were encountered: