Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23aeb0a20c | ||
|
|
a9eb066b53 |
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
@@ -24,7 +24,6 @@ import * as Ref from "effect/Ref";
|
||||
import * as Schedule from "effect/Schedule";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as TestClock from "effect/testing/TestClock";
|
||||
import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner";
|
||||
import { expect } from "vite-plus/test";
|
||||
|
||||
import * as ProcessRunner from "../processRunner.ts";
|
||||
@@ -954,69 +953,6 @@ it.layer(
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("uses platform utility paths for POSIX subprocess polling", () =>
|
||||
Effect.gen(function* () {
|
||||
const calls: ProcessRunner.ProcessRunInput[] = [];
|
||||
const runner = ProcessRunner.ProcessRunner.of({
|
||||
run: (input) => {
|
||||
calls.push(input);
|
||||
const stdout =
|
||||
input.args[0] === "-P"
|
||||
? "10001\n"
|
||||
: input.args[0] === "-eo"
|
||||
? "10001 9000\n"
|
||||
: input.args.includes("comm=")
|
||||
? ""
|
||||
: "/usr/bin/node\n";
|
||||
return Effect.succeed({
|
||||
stdout,
|
||||
stderr: "",
|
||||
code: ChildProcessSpawner.ExitCode(0),
|
||||
timedOut: false,
|
||||
stdoutTruncated: false,
|
||||
stderrTruncated: false,
|
||||
stdoutInvalidUtf8: false,
|
||||
stderrInvalidUtf8: false,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const { manager } = yield* createManager(5, { subprocessPollIntervalMs: 20 }).pipe(
|
||||
Effect.provideService(ProcessRunner.ProcessRunner, runner),
|
||||
Effect.provide(withHostPlatform("darwin")),
|
||||
);
|
||||
yield* manager.open(openInput());
|
||||
yield* waitFor(
|
||||
Effect.sync(() => calls.length >= 4),
|
||||
"1200 millis",
|
||||
);
|
||||
|
||||
expect(calls.slice(0, 4).map(({ command }) => command)).toEqual([
|
||||
"/usr/bin/pgrep",
|
||||
"/bin/ps",
|
||||
"/bin/ps",
|
||||
"/bin/ps",
|
||||
]);
|
||||
|
||||
yield* manager.close({ threadId: "thread-1" });
|
||||
calls.length = 0;
|
||||
|
||||
const { manager: linuxManager } = yield* createManager(5, {
|
||||
subprocessPollIntervalMs: 20,
|
||||
}).pipe(
|
||||
Effect.provideService(ProcessRunner.ProcessRunner, runner),
|
||||
Effect.provide(withHostPlatform("linux")),
|
||||
);
|
||||
yield* linuxManager.open(openInput());
|
||||
yield* waitFor(
|
||||
Effect.sync(() => calls.length >= 4),
|
||||
"1200 millis",
|
||||
);
|
||||
|
||||
expect(calls.slice(0, 4).map(({ command }) => command)).toEqual(["pgrep", "ps", "ps", "ps"]);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("caps persisted history to configured line limit", () =>
|
||||
Effect.gen(function* () {
|
||||
const { manager, ptyAdapter } = yield* createManager(3);
|
||||
|
||||
@@ -703,12 +703,9 @@ const posixInspectSubprocess = Effect.fn("terminal.posixInspectSubprocess")(func
|
||||
ProcessRunner.ProcessRunner
|
||||
> {
|
||||
const processRunner = yield* ProcessRunner.ProcessRunner;
|
||||
// Absolute paths avoid libuv's per-PATH-entry posix_spawn search on macOS.
|
||||
const pgrepCommand = platform === "darwin" ? "/usr/bin/pgrep" : "pgrep";
|
||||
const psCommand = platform === "darwin" ? "/bin/ps" : "ps";
|
||||
const runPgrep = processRunner
|
||||
.run({
|
||||
command: pgrepCommand,
|
||||
command: "pgrep",
|
||||
args: ["-P", String(terminalPid)],
|
||||
timeout: "1 second",
|
||||
maxOutputBytes: 32_768,
|
||||
@@ -728,7 +725,7 @@ const posixInspectSubprocess = Effect.fn("terminal.posixInspectSubprocess")(func
|
||||
|
||||
const runPs = processRunner
|
||||
.run({
|
||||
command: psCommand,
|
||||
command: "ps",
|
||||
args: ["-eo", "pid=,ppid="],
|
||||
timeout: "1 second",
|
||||
maxOutputBytes: 262_144,
|
||||
@@ -779,7 +776,7 @@ const posixInspectSubprocess = Effect.fn("terminal.posixInspectSubprocess")(func
|
||||
}
|
||||
|
||||
const runComm = processRunner.run({
|
||||
command: psCommand,
|
||||
command: "ps",
|
||||
args: ["-p", String(childPid), "-o", "comm="],
|
||||
timeout: "1 second",
|
||||
maxOutputBytes: 8_192,
|
||||
@@ -795,7 +792,7 @@ const posixInspectSubprocess = Effect.fn("terminal.posixInspectSubprocess")(func
|
||||
|
||||
if (!rawComm || rawComm.length === 0) {
|
||||
const runArgs = processRunner.run({
|
||||
command: psCommand,
|
||||
command: "ps",
|
||||
args: ["-p", String(childPid), "-o", "args="],
|
||||
timeout: "1 second",
|
||||
maxOutputBytes: 16_384,
|
||||
|
||||
@@ -18,7 +18,7 @@ function ReleaseNotesLink({
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
className="ml-2 inline cursor-pointer text-muted-foreground underline decoration-dotted underline-offset-4 transition-colors hover:text-foreground"
|
||||
className="ml-2 inline-flex cursor-pointer items-center gap-1 align-baseline text-muted-foreground underline decoration-dotted underline-offset-4 transition-colors hover:text-foreground"
|
||||
onClick={() => {
|
||||
void (async () => {
|
||||
try {
|
||||
@@ -32,11 +32,7 @@ function ReleaseNotesLink({
|
||||
type="button"
|
||||
>
|
||||
Read more
|
||||
<ArrowRightIcon
|
||||
aria-hidden
|
||||
className="ml-1 inline size-3 -rotate-45 align-[-0.125em]"
|
||||
strokeWidth={2.25}
|
||||
/>
|
||||
<ArrowRightIcon aria-hidden className="size-3 -rotate-45" strokeWidth={2.25} />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function TooltipPopup({
|
||||
<TooltipPrimitive.Positioner
|
||||
align={align}
|
||||
anchor={anchor}
|
||||
className="pointer-events-none z-[140] h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none"
|
||||
className="pointer-events-none z-70 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none"
|
||||
data-slot="tooltip-positioner"
|
||||
side={side}
|
||||
sideOffset={sideOffset}
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
openPullRequestLink,
|
||||
parseChangeRequestUrl,
|
||||
PullRequestLinkOpenError,
|
||||
shouldOpenPullRequestExternally,
|
||||
} from "./openPullRequestLink";
|
||||
|
||||
describe("openPullRequestLink", () => {
|
||||
@@ -35,17 +34,6 @@ describe("openPullRequestLink", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldOpenPullRequestExternally", () => {
|
||||
it("uses the browser for command-click and control-click", () => {
|
||||
expect(shouldOpenPullRequestExternally({ metaKey: true, ctrlKey: false })).toBe(true);
|
||||
expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: true })).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps an unmodified click in the pull request view", () => {
|
||||
expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: false })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseChangeRequestUrl", () => {
|
||||
it("reads a GitHub pull request", () => {
|
||||
expect(parseChangeRequestUrl("https://github.com/T3Tools/T3Code/pull/123")).toEqual({
|
||||
|
||||
@@ -173,19 +173,10 @@ export function findProjectForChangeRequest(
|
||||
* should still be reading it afterwards. Any change request opens there, not only the thread's
|
||||
* own, since the panel is told which one to show.
|
||||
*/
|
||||
export function shouldOpenPullRequestExternally(
|
||||
event: Pick<MouseEvent<HTMLElement>, "metaKey" | "ctrlKey">,
|
||||
): boolean {
|
||||
return event.metaKey || event.ctrlKey;
|
||||
}
|
||||
|
||||
export function useOpenChangeRequestLink(
|
||||
threadRef?: ScopedThreadRef,
|
||||
): (
|
||||
event: Pick<
|
||||
MouseEvent<HTMLElement>,
|
||||
"preventDefault" | "stopPropagation" | "metaKey" | "ctrlKey"
|
||||
>,
|
||||
event: Pick<MouseEvent<HTMLElement>, "preventDefault" | "stopPropagation">,
|
||||
targetUrl: string,
|
||||
targetThreadRef?: ScopedThreadRef,
|
||||
) => boolean {
|
||||
@@ -195,7 +186,6 @@ export function useOpenChangeRequestLink(
|
||||
const primaryEnvironmentId = usePrimaryEnvironmentId();
|
||||
return useCallback(
|
||||
(event, targetUrl, targetThreadRef) => {
|
||||
if (shouldOpenPullRequestExternally(event)) return false;
|
||||
const resolvedThreadRef = targetThreadRef ?? threadRef;
|
||||
const environmentId = resolvedThreadRef?.environmentId ?? primaryEnvironmentId;
|
||||
if (
|
||||
|
||||
Reference in new issue
Block a user