fix: 收敛受控 CLI 调用与诊断
This commit is contained in:
@@ -214,6 +214,20 @@ describe("ssh windows fs read-only operations", () => {
|
||||
});
|
||||
|
||||
describe("ssh direct argv boundaries and plane diagnostics", () => {
|
||||
test("rejects host/workspace cwd options locally with an exact route replacement", () => {
|
||||
try {
|
||||
parseSshInvocation("NC01:/root/unidesk", ["exec", "--cwd", "/root/hwlab-v03", "--", "git", "status", "--short"]);
|
||||
throw new Error("expected host cwd input error");
|
||||
} catch (error) {
|
||||
expect(error).toMatchObject({
|
||||
code: "trans-host-cwd-belongs-in-route",
|
||||
usage: "trans NC01:/root/hwlab-v03 'exec' '--' 'git' 'status' '--short'",
|
||||
});
|
||||
}
|
||||
expect(() => parseSshInvocation("NC01:/root/unidesk", ["bash", "--cwd=/root/hwlab-v03"])).toThrow("cwd belongs in the route");
|
||||
expect(() => parseSshInvocation("NC01:k3s:hwlab-v03:hwlab-cloud-api", ["exec", "--cwd", "/workspace", "--", "pwd"])).not.toThrow();
|
||||
});
|
||||
|
||||
test("preserves a shell-formed argv token containing spaces and Chinese", () => {
|
||||
const invocation = parseSshInvocation("G14-WSL:/mnt/d/Work/CONSTAR_workspace", [
|
||||
"python3",
|
||||
|
||||
Reference in New Issue
Block a user