55 Commits

Author SHA1 Message Date
Mitchell Hashimoto
8e47d0267b Move resource limits to a dedicated struct, restore before preexec 2025-01-02 15:05:10 -08:00
Jeffrey C. Ollie
9ea0aa4934 core: if we change RLIMIT_NOFILE, reset it when executing commands 2025-01-01 14:31:15 -06:00
Anund
600eea08cd testing: point Command.zig at ~more universal external binaries
The `Command.zig` tests reach outside the local source tree and look for
files on the host os machine. This introduces some portability issues
for the tests.

The nix build sandbox doesn't include `/usr/bin/env` making it error out
when `zig build test` runs `Command.zig` tests as part of a `nix build`.
Current ci and local development relies on `nix develop` sharing a host os
file system that includes `/usr/bin/env`.

Turns out `/tmp` and `/bin/sh` are available in the build sandbox in
nix so we swap these in to enable nixpkg builds to include testing
ghostty as part of any update cycle.
2024-12-27 17:07:24 +11:00
Anund
b2cb80dfbb testing: move cleanup of execveZ into the test code 2024-12-27 11:08:45 +11:00
Anund
184db2654c testing: handle execveZ failing during test execution
Duplicating a test process via fork does unexepected things.
zig build test will hang
A test binary created via -Demit-test-exe will run 2 copies of the test suite
2024-12-27 11:08:44 +11:00
Khang Nguyen Duy
cb5848c7b7 command: fix hostname test compatibility
hostname is not guaranteed on *nix as in the comment.
For example, Arch does not have hostname by default.
2024-12-11 16:54:28 +07:00
multifred
72c672adb7 Fix multiple deprecated names for zig lib/std 2024-07-22 00:07:17 +02:00
Mitchell Hashimoto
9baf4d143d command: if chdir fails for subprocess, ignore the error
Fixes #1911
2024-07-02 09:47:50 -07:00
Mitchell Hashimoto
6ae6e3ba11 remove unused var 2024-06-08 19:08:05 -07:00
Mitchell Hashimoto
8f9cdff1f5 small stylistic tweaks 2024-06-08 19:07:10 -07:00
Jeffrey C. Ollie
af9efd4d93 use consistent type for pid 2024-06-08 07:43:44 -06:00
Jeffrey C. Ollie
e6f97c28f8 Use clone3 / CLONE_INTO_CGROUP on Linux
Use clone3 / CLONE_INTO_CGROUP to have the Linux kernel create the process in the
correct cgroup rather than move the process into the cgroup after it is created.
2024-06-07 23:48:03 -06:00
Jon Parise
b1e1d8c3eb os: std.ChildProcess -> std.process.Child
std.ChildProcess was deprecated in favor of std.process.Child a few
releases back, and the old name is removed in Zig 0.13.0.
2024-06-07 12:36:30 -04:00
Mitchell Hashimoto
b7bf59d772 update zig 2024-03-22 11:15:26 -07:00
Mitchell Hashimoto
8456e9d7f7 command: io_mode removed for windows 2024-02-10 16:58:45 -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
Jeffrey C. Ollie
f4292bccfc replace deprecated std.mem.tokenize with std.mem.tokenizeScalar 2024-01-03 10:22:33 -06:00
Mitchell Hashimoto
2ed75d47b5 termio/exec: detect exec failure and show an error message 2023-12-30 15:07:23 -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
Krzysztof Wolicki
44a48f62f1 change unmodified vars to consts in anticipation of zig changes 2023-11-17 15:46:46 +01:00
Mitchell Hashimoto
1a846597b1 command: stylistic changes 2023-11-05 18:03:22 -08:00
Mitchell Hashimoto
7594bbd621 shuffle some source around 2023-11-05 15:27:46 -08: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
b049cb7d21 command: allow relative paths in PATH 2023-10-26 09:30:11 -07:00
Nameless
49f1866f28 add tests for fuzzed results, clean up unimplemented osc warning 2023-10-25 11:44:16 -05: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
Will Pragnell
8f2ab46e1e windows: use cross platform consts where available 2023-09-15 16:01:33 -07:00
Will Pragnell
d700fb6fc7 windows: implement expandPath 2023-09-14 20:48:09 -07:00
Jonathan Marler
a2e881ff4e windows: initial support for zig build test
Makes progress getting "zig build test" to work on windows.  Mostly
fixed issues around build configuration and added some branches throughout
the Zig code to return/throw errors for unimplemented parts.

I also added an initial implementation for getting the home dir.
2023-09-14 03:15:40 -06:00
Will Pragnell
2e54ad2cce command: only spin on waitpid if it's non-blocking 2023-08-31 07:51:50 -07:00
Will Pragnell
aa9e12dac2 termio/exec: don't leak zombie subprocesses 2023-08-30 21:37:38 -07:00
Mitchell Hashimoto
9a0d131b5b move TempDir to src/os and use the real tmpDir 2023-07-09 12:14:05 -07:00
Mitchell Hashimoto
314f9287b1 Update Zig (#164)
* update zig

* pkg/fontconfig: clean up @as

* pkg/freetype,harfbuzz: clean up @as

* pkg/imgui: clean up @as

* pkg/macos: clean up @as

* pkg/pixman,utf8proc: clean up @as

* clean up @as

* lots more @as cleanup

* undo flatpak changes

* clean up @as
2023-06-30 12:15:31 -07:00
Mitchell Hashimoto
7116ce0806 update zig version 2023-05-29 08:24:12 -07:00
Mitchell Hashimoto
ce86c64b42 update zig, src for loops 2023-02-27 21:46:42 -08:00
Mitchell Hashimoto
ec956debb7 Command/Pty work better with Flatpak but not 100% yet 2023-02-25 21:19:57 -08:00
Mitchell Hashimoto
465b4df6ea fix tests for WNOHANG commit 2022-11-16 21:04:31 -08:00
Mitchell Hashimoto
d567a976b4 waitpid should specify WNOHANG
If the child process our terminal is executing behaves poorly and
doesn't waitpid all of its own children, then we can hang the full
terminal. This is not ideal, so specify WNOHANG.
2022-11-16 20:54:17 -08:00
Mitchell Hashimoto
63fab367fe Command supports setting cwd 2022-11-01 17:51:50 -07:00
Mitchell Hashimoto
c7db5b96d6 get rid of stage1 compat 2022-11-01 14:10:35 -07:00
Mitchell Hashimoto
a3d9dad726 fix tests so they pass on mac 2022-09-30 13:24:54 -07:00
Mitchell Hashimoto
a1d238e385 Fix a couple bugs in memory access (tests only) 2022-09-23 12:51:50 -07:00
Mitchell Hashimoto
d16c672771 update Zig, fixed new invalid octal error 2022-08-19 08:58:27 -07:00
Mitchell Hashimoto
5c2edf4d2a Fix some stage2 compilation errors 2022-08-17 14:42:23 -07:00
Mitchell Hashimoto
5b47195e49 update zig 2022-05-17 12:05:56 -07:00
Mitchell Hashimoto
e462f35727 don't ignore fcntl return for macos 2022-04-26 17:14:26 -07:00
Mitchell Hashimoto
b74b6103ea update command comments 2022-04-26 14:51:26 -07:00
Mitchell Hashimoto
22c34512cb Command: setup fd properly on mac 2022-04-26 14:42:42 -07:00
Mitchell Hashimoto
6613ae0f8f libuv: starting Tty impl 2022-04-24 21:57:52 -07:00
Mitchell Hashimoto
9cc19b0553 execute the child command 2022-04-24 14:33:25 -07:00