Open rempas opened 7 months ago
Thanks for reporting, though it's hard to get to the root of the issue you're describing. Are you seeing that spawnSync
works the first time, then not the second? (what happens the 2nd time, does it throw an error, does not just show no output? does it work a third/fourth time?)
Thanks for reporting, though it's hard to get to the root of the issue you're describing. Are you seeing that
spawnSync
works the first time, then not the second? (what happens the 2nd time, does it throw an error, does not just show no output? does it work a third/fourth time?)
So, here is what's going on! First, I am using spawnSync
to check if a bunch of compilers are installed in the system (look at the default_compilers
variable). If a check fails, I know that the compiler doesn't exist. In that part, it seems to be working correctly, as it finds "gcc" and "clang" and it doesn't find anything else.
After that, I go to the actual compilation. There is a list of benchmarks (look at the benchmarks
variable) that I run for each compiler that was found ("gcc" and "clang" in my case). For testing purposes, I have only kept 2 benchmarks. With that in mind, the compile_test
function will run 8 times to check the compilers and then, 2 (number of benchmarks) times 2 (number of compilers), a total of 4 times for the actual compilation of the benchmarks! After the compilation is done, we try to execute these files from another function (run_test
). Every benchmark is compiled and then run. Then we go to the next one, until we are done.
The first benchmark is a file called "array.c" so, we should have an output called "array.gcc" when GCC compiles it and "array.clang" when clang compiles it. This works correctly! The second one is a file called "binary-trees.c" so, GCC creates "binary-trees.gcc" and clang creates "binary-trees.clang". This doesn't happen, however! Unless I mess something in the loop, and it runs the first benchmark again, there must be a problem with spawnSync
. This doesn't seem to be the problem however, as you will see, there is a console.log
that prints the output that is about to be created! In the first benchmark, everything is ok but in the second time, spawnSync
still executes without problems but when I used existsSync
(from "node:fs"), the output files are not there!
What version of Bun is running?
1.0.15+b3bdf22eb
What platform is your computer?
Linux 6.6.2-arch1-1 x86_64 unknown
What steps can reproduce the bug?
I am trying to use
Bun.SpawnSync
to run c compilers (gcc and clang for now) for a number of files. The idea is to create an alternative benchmark suite for Mir. I have limited the benchmarks to only two for now. The first one is compiled correctly, and the file is created. The second one is not. While the command is run correctly (no "catch"), I look at my directory and the file is not there.The script is meant to run from the root directory! There are messages (
console.log
andconsole.error
) that will help you understand what's going on in more detail.What is the expected behavior?
To "spawn" the c compilers and create the output files. The first one is created. The second isn't.
What do you see instead?
What I do NOT see is the real question! I do not see the file I expect to see...
Additional information
I don't know. Ask me whatever you need! I'll be glad to help :)