mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-21 03:06:15 +03:00
1
.github/workflows/nix.yml
vendored
1
.github/workflows/nix.yml
vendored
@ -14,5 +14,6 @@ jobs:
|
||||
with:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
useDaemon: false # sometimes fails on short jobs
|
||||
- name: Check Zig cache hash
|
||||
run: nix develop -c ./nix/build-support/check-zig-cache-hash.sh
|
||||
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -220,6 +220,8 @@ jobs:
|
||||
with:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
skipPush: true
|
||||
useDaemon: false # sometimes fails on short jobs
|
||||
- name: prettier check
|
||||
run: nix develop -c prettier --check .
|
||||
|
||||
@ -234,5 +236,7 @@ jobs:
|
||||
with:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
skipPush: true
|
||||
useDaemon: false # sometimes fails on short jobs
|
||||
- name: alejandra check
|
||||
run: nix develop -c alejandra --check .
|
||||
|
@ -24,7 +24,7 @@ const Command = @import("src/Command.zig");
|
||||
// but we liberally update it. In the future, we'll be more careful about
|
||||
// using released versions so that package managers can integrate better.
|
||||
comptime {
|
||||
const required_zig = "0.12.0-dev.2075+f5978181e";
|
||||
const required_zig = "0.12.0-dev.2701+d18f52197";
|
||||
const current_zig = builtin.zig_version;
|
||||
const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable;
|
||||
if (current_zig.order(min_zig) == .lt) {
|
||||
|
12
flake.lock
generated
12
flake.lock
generated
@ -147,11 +147,11 @@
|
||||
},
|
||||
"nixpkgs-zig-0-12": {
|
||||
"locked": {
|
||||
"lastModified": 1707156663,
|
||||
"narHash": "sha256-T0Ah65Sj/HnbEkKmOCaQGSIoNDZDh3K299A0nvXceCk=",
|
||||
"lastModified": 1707614255,
|
||||
"narHash": "sha256-26jDBuCgewZb+ifR3Ow6cZS/6Mz09pwC4ukKWtOjFZk=",
|
||||
"owner": "vancluever",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dfe11015af91c9317604d792715f166d9fce7831",
|
||||
"rev": "85b992eb1a8d3a3742ddb21eba7f79b0e4f2e78b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -194,11 +194,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1707148508,
|
||||
"narHash": "sha256-fAQN2Y8wZn8JQWQvA5dfDEorxZLLWTNSdZp39YFAWXk=",
|
||||
"lastModified": 1707611073,
|
||||
"narHash": "sha256-sMsxVKXP5TLcaVMNlRZ7KlDsYGwDdJAMtY0DKmb+7fQ=",
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "3e47b1a260a5521e51888b8e71cd04b8e8928cb3",
|
||||
"rev": "aa4edff6f53e64443ca77e8d9ffe866f29e5b3d4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -178,7 +178,6 @@ fn startWindows(self: *Command, arena: Allocator) !void {
|
||||
.access_mask = windows.GENERIC_READ | windows.SYNCHRONIZE,
|
||||
.share_access = windows.FILE_SHARE_READ,
|
||||
.creation = windows.OPEN_EXISTING,
|
||||
.io_mode = .blocking,
|
||||
},
|
||||
) else null;
|
||||
defer if (null_fd) |fd| std.os.close(fd);
|
||||
|
@ -109,58 +109,60 @@ pub fn main() !MainReturn {
|
||||
try app_runtime.run();
|
||||
}
|
||||
|
||||
pub const std_options = struct {
|
||||
// The function std.log will call.
|
||||
fn logFn(
|
||||
comptime level: std.log.Level,
|
||||
comptime scope: @TypeOf(.EnumLiteral),
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
// Stuff we can do before the lock
|
||||
const level_txt = comptime level.asText();
|
||||
const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
|
||||
|
||||
// Lock so we are thread-safe
|
||||
std.debug.getStderrMutex().lock();
|
||||
defer std.debug.getStderrMutex().unlock();
|
||||
|
||||
// On Mac, we use unified logging. To view this:
|
||||
//
|
||||
// sudo log stream --level debug --predicate 'subsystem=="com.mitchellh.ghostty"'
|
||||
//
|
||||
if (builtin.target.isDarwin()) {
|
||||
// Convert our levels to Mac levels
|
||||
const mac_level: macos.os.LogType = switch (level) {
|
||||
.debug => .debug,
|
||||
.info => .info,
|
||||
.warn => .err,
|
||||
.err => .fault,
|
||||
};
|
||||
|
||||
// Initialize a logger. This is slow to do on every operation
|
||||
// but we shouldn't be logging too much.
|
||||
const logger = macos.os.Log.create("com.mitchellh.ghostty", @tagName(scope));
|
||||
defer logger.release();
|
||||
logger.log(std.heap.c_allocator, mac_level, format, args);
|
||||
}
|
||||
|
||||
switch (state.logging) {
|
||||
.disabled => {},
|
||||
|
||||
.stderr => {
|
||||
// Always try default to send to stderr
|
||||
const stderr = std.io.getStdErr().writer();
|
||||
nosuspend stderr.print(level_txt ++ prefix ++ format ++ "\n", args) catch return;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const std_options: std.Options = .{
|
||||
// Our log level is always at least info in every build mode.
|
||||
pub const log_level: std.log.Level = switch (builtin.mode) {
|
||||
.log_level = switch (builtin.mode) {
|
||||
.Debug => .debug,
|
||||
else => .info,
|
||||
};
|
||||
},
|
||||
|
||||
// The function std.log will call.
|
||||
pub fn logFn(
|
||||
comptime level: std.log.Level,
|
||||
comptime scope: @TypeOf(.EnumLiteral),
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
// Stuff we can do before the lock
|
||||
const level_txt = comptime level.asText();
|
||||
const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
|
||||
|
||||
// Lock so we are thread-safe
|
||||
std.debug.getStderrMutex().lock();
|
||||
defer std.debug.getStderrMutex().unlock();
|
||||
|
||||
// On Mac, we use unified logging. To view this:
|
||||
//
|
||||
// sudo log stream --level debug --predicate 'subsystem=="com.mitchellh.ghostty"'
|
||||
//
|
||||
if (builtin.target.isDarwin()) {
|
||||
// Convert our levels to Mac levels
|
||||
const mac_level: macos.os.LogType = switch (level) {
|
||||
.debug => .debug,
|
||||
.info => .info,
|
||||
.warn => .err,
|
||||
.err => .fault,
|
||||
};
|
||||
|
||||
// Initialize a logger. This is slow to do on every operation
|
||||
// but we shouldn't be logging too much.
|
||||
const logger = macos.os.Log.create("com.mitchellh.ghostty", @tagName(scope));
|
||||
defer logger.release();
|
||||
logger.log(std.heap.c_allocator, mac_level, format, args);
|
||||
}
|
||||
|
||||
switch (state.logging) {
|
||||
.disabled => {},
|
||||
|
||||
.stderr => {
|
||||
// Always try default to send to stderr
|
||||
const stderr = std.io.getStdErr().writer();
|
||||
nosuspend stderr.print(level_txt ++ prefix ++ format ++ "\n", args) catch return;
|
||||
},
|
||||
}
|
||||
}
|
||||
.logFn = logFn,
|
||||
};
|
||||
|
||||
/// This represents the global process state. There should only
|
||||
|
Reference in New Issue
Block a user