1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-30 14:49:26 +03:00
Commit Graph

27 Commits

Author SHA1 Message Date
Jalil David Salamé Messina
d541e2e13d fix(clippy): Remove closures where possible
- Removes closures and function calls for types that implement default:

  ```rust
  // Change
  let _my_str = get_str().unwrap_or(String::new);
  // To
  let _my_str = get_str().unwrap_or_default();
  ```

- Uses the `.cloned()/.copied()` methods where possible
- Use function pointer instead of simple closure

May improve performace, as closures generate more code, and this might
unlock some inlining opportunities.
2023-03-19 08:41:38 -07:00
Jalil David Salamé Messina
191aacc7d7 fix(clippy): Use faster methods on Iterators
- Use `find` instead of `position(..).next()`
- Use `any` instead of `position(..).next().is_some()/.is_none()`
- Use `first/next` instead of `get(0)/nth(0)`
- Prefer `for` loops over `while let` loops on iterators

May improve performance.
2023-03-19 07:29:23 -07:00
Wez Furlong
aefbb6b4a0
deps: update ntapi to 0.4
Avoids:

```
warning: the following packages contain code that will be rejected by a future version of Rust: ntapi v0.3.7
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 36`
```
2022-12-30 08:37:53 -07:00
Mikayla Maki
32771eecc6 Rearranged order of trimming and parsing 2022-09-06 20:14:27 -07:00
Mikayla Maki
d74cb1b625 Added extra test 2022-09-06 20:14:27 -07:00
Mikayla Maki
d7c4898f3d Add tests for sysctl parsing 2022-09-06 20:14:27 -07:00
Mikayla Maki
75a7c38800 Change wording 2022-09-06 20:14:27 -07:00
Mikayla Maki
ffae6818ef Fixed small bug in how procinfo reads sysctl KERN_PROCARGS2 2022-09-06 20:14:27 -07:00
K Simmons
6166008b18 Make procinfo's lua dependency optional 2022-09-06 20:14:27 -07:00
Thomas Kilian
d7b1ade1ac Added winapi feature "shellapi" to procinfo 2022-06-23 09:08:05 -07:00
Wez Furlong
862dbc604a cut more things over to dynamic 2022-05-18 07:47:39 -07:00
Wez Furlong
f587cac145 config: cut over to wezterm-dynamic
Avoid using serde for mapping between Lua and Rust for the `Config`
struct.

This improves the build speed of the config crate by 2x; it goes down
from 30 seconds to 9 seconds on my 5950x.
2022-05-18 07:47:39 -07:00
Wez Furlong
f9c4855159 procinfo: windows: tweak and add more tracing
Use an alternative function to query the executable path for
a target process.

Add more tracing.

refs: #1896
2022-04-20 09:43:56 -07:00
Wez Furlong
92893f2a34 procinfo: defend against weird situations on Windows
I've had a couple of deadlock situations when invoking win32 apps
via wsl on my work machine.  In those situations, the process that
we show in the titlebar is a short lived process that has likely
recently terminated, so I suspect something weird about either
dangling references or, given the deadlock-y nature of things,
maybe trying to reference ourselves.

This commit tries to defend against these by:

* Avoiding creating a ProcHandle for our own pid
* Releasing the toolhelper snapshot as soon as we have copied
  out the list of pids that we need

Not sure that this will nail it, but it seems like it can't hurt.
2022-04-19 08:46:32 -07:00
Wez Furlong
b2ba7383b0 windows: procinfo: extra defensive coding around reading proc info
Might possibly help with #1699
2022-04-05 08:54:05 -07:00
Wez Furlong
e148cfe8e3 procinfo: tidy up windows impl a bit 2022-01-01 10:01:19 -07:00
Wez Furlong
6a7fd37d34 procinfo: add some comments 2022-01-01 09:53:56 -07:00
Wez Furlong
5660942055 procinfo: add windows console field. mux: ignore non-console procs
When considering the fg process, we don't want a newly spawned
notepad.exe to show as the fg process in a cmd/pwsh pane, as it
runs async from the console and isn't attached to it.

We can extract the console handle from the process information and
use a 0 value handle to indicate win32 apps that are not attached
to any console.

We cannot compare console handle values directly: without probing
deeper into the handle we don't know that two differently valued
handles refer to different consoles, because a handle can be
duplicated into another with a different numeric value.
2022-01-01 09:40:18 -07:00
Wez Furlong
8c66d02364 procinfo: fix build on freebsd 2021-12-31 22:50:53 -07:00
Wez Furlong
20d9ded070 procinfo: add some comments! 2021-12-31 22:49:08 -07:00
Wez Furlong
ed958160f3 procinfo: fixup macos build 2021-12-31 21:46:36 -07:00
Wez Furlong
3e05ee667f procinfo: fix linux build 2021-12-31 21:31:28 -07:00
Wez Furlong
1ad4015f9c procinfo: reorg a bit; enable cwd probing on windows
Likely breaks the mac and windows builds
2021-12-31 21:28:03 -07:00
Wez Furlong
e16a27dfb3 procinfo: fmt/refactor
Just moves some code around
2021-12-31 20:05:27 -07:00
Wez Furlong
6650879260 move platform logic about LocalProcessInfo into procinfo crate 2021-12-31 19:45:09 -07:00
Wez Furlong
416c700841 procinfo: start_time is now in unspecified units since boot 2021-12-31 19:39:37 -07:00
Wez Furlong
910b111efa move procinfo bits into own crate 2021-12-31 19:31:21 -07:00