87 Commits

Author SHA1 Message Date
Mitchell Hashimoto
01bfce0981 os: cgroup can set memory limits 2024-06-04 21:02:25 -07:00
Mitchell Hashimoto
d351e80158 os: cgroup create/move 2024-06-04 20:22:17 -07:00
Mitchell Hashimoto
bbe525c964 os: API to configure cgroup controllers 2024-06-04 19:36:48 -07:00
Mitchell Hashimoto
b5c4d2f60d os: rename linux => cgroup 2024-06-04 19:28:12 -07:00
Mitchell Hashimoto
c0b061edd9 os: API for listing cgroup controllers 2024-06-04 19:23:18 -07:00
Mitchell Hashimoto
0a5f3fa0a4 os: add linux API for getting cgroup by pid 2024-06-04 15:15:11 -07:00
Gregory Anders
695bc307ba os/open: do not wait for commands which do not terminate
Some opener commands (like macOS's open) finish immediately after
running, while others (xdg-open) do not, staying alive until the
application that was opened itself terminates.

For now, we explicitly state whether or not we should wait for a
command. Eventually we may want to do something more generic (e.g. wait
for some predetermined amount of time and if the process does not
complete, give up without collecting stderr).
2024-05-31 12:25:17 -05:00
Mitchell Hashimoto
1e60f7186c os: some stylistic changes, comments for stderr logging 2024-05-20 19:11:30 -04:00
Gregory Anders
e710a59a43 os: log stderr from open command 2024-05-19 09:00:53 -05:00
Jon Parise
29a5b52885 os/homedir: remove now unnecessary fba.reset() 2024-03-31 08:56:56 -07:00
Jon Parise
55b611e4cb os/homedir: use NSFileManager on macOS
NSFileManager has offered a homeDirectoryForCurrentUser property since
macOS 10.12. Using that is preferable to running a directory service
child process.
2024-03-30 20:24:43 -07:00
Mitchell Hashimoto
b7bf59d772 update zig 2024-03-22 11:15:26 -07:00
Krzysztof Wolicki
f4e8982e5c Windows Utf8 -> Wtf8 2024-02-26 18:01:06 +01:00
Jonathan Marler
e1996ad1e5 os: remove UB, tmpDir is returning stack memory on Windows
On Windows, the tmpDir function is currently using a buffer on the stack
to convert the WTF16-encoded environment variable value "TMP" to utf8
and then returns it as a slice...but that stack buffer is no longer valid
when the function returns.  This was causing the "image load...temporary
file" test to fail on Windows.

I've updated the function to take an allocator but it only uses
the allocator on Windows.  No allocation is needed on other platforms
because they return environment variables that are already utf8 (ascii)
encoded, and the OS pre-allocates all environment variables in the process.
To keep the conditional that determines when allocation is required, I
added the `freeTmpDir` function.
2024-02-10 21:09:05 -07:00
Mitchell Hashimoto
c2e0cff1d2 termio/exec: only add ghostty path if it isn't already in path 2024-01-31 18:57:42 -08:00
Mitchell Hashimoto
470b57f194 os: no mouse interval on ios 2024-01-14 14:48:56 -08:00
Mitchell Hashimoto
3360a008cd build: build produces a broken object file for iOS
This gets `zig build -Dtarget=aarch64-ios` working. By "working" I mean
it produces an object file without compiler errors. However, the object
file certainly isn't useful since it uses a number of features that will
not work in the iOS sandbox.

This is just an experiment more than anything to see how hard it would be to
get libghostty working within iOS to render a terminal. Note iOS doesn't
support ptys so this wouldn't be a true on-device terminal. The
challenge right now is to just get a terminal rendering (not usable).
2024-01-13 21:38:58 -08:00
Mitchell Hashimoto
8a816dc5ef os: mac app launched with bundle env var is treated as desktop launch 2024-01-06 12:30:44 -08:00
Mitchell Hashimoto
86bd972d22 macos: do not change nofile rlimit max
Fixes #1146

I can't remember why we did this before. The comment in question makes
sense if we were trying to set cur to infinity but doesn't make sense to
me why we'd change max. Removing this doesn't seem to cause any issues
so lets give it a shot.
2023-12-22 08:58:31 -08:00
Gregory Anders
18f2fb3fbd macos: include ghostty subdirectory under Resources
This enables us to treat Ghostty's resources directory the same way
whether it is installed in a macOS app bundle or under e.g. /usr/share.
2023-12-21 17:56:57 -08:00
Gregory Anders
8751502878 core: look for resources in "ghostty" subdirectory for "share" paths
Installing resources directly under ${prefix}/share causes conflicts
with other packages. This will become more problematic whenever Ghostty
is opened and becomes packaged in distributions.

Instead, install all resources under a "ghostty" subdirectory (i.e.
${prefix}/share/ghostty). This includes themes, shell integration, and
terminfo files.

Only "/usr/share" style paths use the "ghostty" subdirectory. On macOS,
Ghostty is already isolated within its app bundle, and if
$GHOSTTY_RESOURCES_DIR is set then we assume that points to the actual
resources dir (without needing to append "ghostty" to it).
2023-12-21 17:56:17 -08:00
Mitchell Hashimoto
2732ca9c5c os: passwd also gets username 2023-12-13 15:35:21 -08:00
Krzysztof Wolicki
0750698b62 Update to latest master,
update libxev dependency,
change mach_glfw to an updated fork until upstream updates
2023-11-30 21:41:33 +01:00
Mitchell Hashimoto
995e4e3757 os: open 2023-11-29 15:30:22 -08:00
Mitchell Hashimoto
67dce5ce0e update zig-objc 2023-11-17 21:50:34 -08:00
Krzysztof Wolicki
44a48f62f1 change unmodified vars to consts in anticipation of zig changes 2023-11-17 15:46:46 +01:00
Krzysztof Wolicki
0822e99a56 os/xdg: Add LOCALAPPDATA as a fallback for XDG_CONFIG_HOME on Windows 2023-11-13 02:05:29 +01:00
Mitchell Hashimoto
3dc2bbc9b0 os: add internal_os.pipe for cross-platfor pipe 2023-11-05 15:54:50 -08:00
Mitchell Hashimoto
fbd2c34487 os: more comments 2023-11-05 15:48:43 -08:00
Mitchell Hashimoto
b39d1d6095 shuffle some code 2023-11-05 15:46:31 -08:00
Mitchell Hashimoto
ea5ff77e29 os: macos lang check should include lang null 2023-11-05 15:46:05 -08:00
Mitchell Hashimoto
74b840df8e rename Pty.zig to pty.zig 2023-11-05 23:41:45 +00:00
Mitchell Hashimoto
8f35d5251e os: rename env to be posix-like, do not allocate on posix 2023-11-05 15:39:25 -08:00
Mitchell Hashimoto
7594bbd621 shuffle some source around 2023-11-05 15:27:46 -08:00
kcbanner
9a5322eaf4 - Update libxev dependency
- Fixup macos compile error
2023-11-05 23:15:52 +00:00
kcbanner
232df8de8f windows: add support for the glfw backend on Windows
Changes:
- Add WindowsPty, which uses the ConPTY API to create a pseudo console
- Pty now selects between PosixPty and WindowsPty
- Windows support in Command, including the ability to launch a process with a pseudo console
- Enable Command tests on windows
- Add some environment variable abstractions to handle the missing libc APIs on Windows
- Windows version of ReadThread
2023-11-05 23:15:49 +00:00
Mitchell Hashimoto
7a1c54ad05 update zig 2023-10-24 15:02:26 -07:00
Mitchell Hashimoto
cbdf52864a Merge pull request #704 from der-teufel-programming/windows-test
Get `zig build test` working on Windows
2023-10-23 08:52:43 -07:00
Mitchell Hashimoto
4a199448a2 os: update todo about subsystem for windows 2023-10-23 08:48:53 -07:00
Mitchell Hashimoto
3226cbf61b os: remove some duplication in the env var check for xdg config 2023-10-23 08:47:16 -07:00
Brandon Ferguson
17957b8fb3 If the locale isn't supported and falls back to the POSIX/C locale, use en_US.UTF8 2023-10-21 10:33:26 -07:00
Krzysztof Wolicki
f4a2273ad9 os/xdg: Avoid allocations on non-Windows systems.
os/desktop: Add TODO
2023-10-19 17:22:11 +02:00
Krzysztof Wolicki
3936b471a8 Disable iconv on Windows by default (enabled via cli flag).
Skip various tests not implemented on windows.
2023-10-19 09:39:20 +02:00
Mitchell Hashimoto
2b28106837 update zig 2023-10-02 08:18:35 -07:00
Mitchell Hashimoto
3c0700c6b0 os: launchFromDesktop works even if the artifact is a lib
Fixes #598
2023-09-30 19:09:52 -07:00
Mitchell Hashimoto
d03083c7f5 apprt/gtk: default working-directory to home if launched from desktop
Fixes #573
2023-09-29 15:52:45 -07:00
Mitchell Hashimoto
d878d16779 os: unset lang completely setlocale fails 2023-09-29 13:11:07 -07:00
Mitchell Hashimoto
38a7c2270b os: we need to copy the old lang pointer before we unsetenv 2023-09-29 12:56:43 -07:00
Mitchell Hashimoto
0026c40062 Simplify setlocale logic to rely on libc to fail if invalid
Instead of checking if a locale is valid, let's change this logic:

  1. We first try setlocale to inherit from env vars, system default.
  2. Next, we fall back to unsetting LANG if it was set manually,
     allowing us to fall back to system defaults.
  3. We fall back to en_US.UTF-8.
2023-09-26 17:35:19 -07:00
Mitchell Hashimoto
ea4bc95f43 os: appendEnv 2023-09-20 13:02:06 -07:00