Zig does not run the command or any other steps during build; it is actually a configure phase.
captureStdOut returns a generated file specification and not the actual output.
You can save the contents of captureStdOut as a file; search for captureStdOut in Zig Build System for an example that saves the command output to a file.
I think a better way is to add a check in the system command using expectStdOutEqual.
shader_compilation.expectStdOutEqual("");
If the resulted output is not empty you get the failed check report:
========= expected this stdout: =========
========= but found: ====================
HERE GOES THE OUTPUT...
========= from the following command: ===
glslangValidator --target-env ...