mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
* Prepare to upgrade zig
* zig fmt
* AllocGate
* Update data_url.zig
* wip
* few files
* just headers now?
* I think everything works?
* Update mimalloc
* Update hash_map.zig
* Perf improvements to compensate for Allocgate
* Bump
* 📷
* Update bun.lockb
* Less branching
* [js parser] Slightly reduce memory usage
* Update js_parser.zig
* WIP remove unused
* [JS parser] WIP support for `with` keyword
* Remove more dead code
* Fix all the build errors!
* cleanup
* Move `network_thread` up
* Bump peechy
* Update README.md
35 lines
1.0 KiB
Zig
35 lines
1.0 KiB
Zig
const _global = @import("./global.zig");
|
|
const string = _global.string;
|
|
const Output = _global.Output;
|
|
const Global = _global.Global;
|
|
const Environment = _global.Environment;
|
|
const strings = _global.strings;
|
|
const MutableString = _global.MutableString;
|
|
const stringZ = _global.stringZ;
|
|
const default_allocator = _global.default_allocator;
|
|
const C = _global.C;
|
|
const std = @import("std");
|
|
|
|
const opener = switch (@import("builtin").target.os.tag) {
|
|
.macos => "/usr/bin/open",
|
|
.windows => "start",
|
|
else => "xdg-open",
|
|
};
|
|
|
|
pub fn openURL(url: string) !void {
|
|
if (comptime Environment.isWasi) {
|
|
Output.prettyln("-> {s}", .{url});
|
|
Output.flush();
|
|
return;
|
|
}
|
|
|
|
var args_buf = [_]string{ opener, url };
|
|
var child_process = try std.ChildProcess.init(&args_buf, default_allocator);
|
|
child_process.stderr_behavior = .Pipe;
|
|
child_process.stdin_behavior = .Ignore;
|
|
child_process.stdout_behavior = .Pipe;
|
|
try child_process.spawn();
|
|
_ = try child_process.wait();
|
|
return;
|
|
}
|