mirror of
https://github.com/ziglang/zig.git
synced 2025-12-30 18:13:19 +00:00
src/print_env: print the native target
Add the native target triple to the zig env command output. The target triple is formatted the same way as it is done in the zig targets command.
This commit is contained in:
parent
1d041d3a10
commit
3250b20cea
@ -21,6 +21,10 @@ pub fn cmdEnv(gpa: Allocator, args: []const []const u8, stdout: std.fs.File.Writ
|
||||
const global_cache_dir = try introspect.resolveGlobalCacheDir(gpa);
|
||||
defer gpa.free(global_cache_dir);
|
||||
|
||||
const info = try std.zig.system.NativeTargetInfo.detect(gpa, .{});
|
||||
const triple = try info.target.zigTriple(gpa);
|
||||
defer gpa.free(triple);
|
||||
|
||||
var bw = std.io.bufferedWriter(stdout);
|
||||
const w = bw.writer();
|
||||
|
||||
@ -42,6 +46,9 @@ pub fn cmdEnv(gpa: Allocator, args: []const []const u8, stdout: std.fs.File.Writ
|
||||
try jws.objectField("version");
|
||||
try jws.emitString(build_options.version);
|
||||
|
||||
try jws.objectField("target");
|
||||
try jws.emitString(triple);
|
||||
|
||||
try jws.endObject();
|
||||
try w.writeByte('\n');
|
||||
try bw.flush();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user