Archived
feat(terminals): set PI WEB shell environment
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jmfederico/pi-web": patch
|
||||
---
|
||||
|
||||
Set `IS_PIWEB=1` in PI WEB terminal shells.
|
||||
@@ -140,5 +140,8 @@
|
||||
"./extensions"
|
||||
],
|
||||
"image": "https://raw.githubusercontent.com/jmfederico/pi-web/main/docs/assets/pi-web-banner.png"
|
||||
},
|
||||
"allowScripts": {
|
||||
"[email protected]": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,24 @@ describe.skipIf(process.platform === "win32")("TerminalService command runs", ()
|
||||
}
|
||||
});
|
||||
|
||||
it("sets IS_PIWEB for terminal commands", async () => {
|
||||
const service = new TerminalService();
|
||||
try {
|
||||
const run = service.runCommand({
|
||||
origin: "core",
|
||||
projectId: "p1",
|
||||
workspaceId: "w1",
|
||||
cwd: process.cwd(),
|
||||
title: "Environment check",
|
||||
command: "printf '%s' \"$IS_PIWEB\"",
|
||||
});
|
||||
|
||||
expect(await terminalExit(service, run.terminalId)).toContain("1");
|
||||
} finally {
|
||||
service.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
it("tracks dedicated terminal command runs through completion", async () => {
|
||||
const service = new TerminalService();
|
||||
try {
|
||||
|
||||
@@ -163,7 +163,7 @@ export class TerminalService {
|
||||
cwd: record.cwd,
|
||||
cols: 100,
|
||||
rows: 30,
|
||||
env: { ...process.env, TERM: "xterm-256color" },
|
||||
env: { ...process.env, TERM: "xterm-256color", IS_PIWEB: "1" },
|
||||
});
|
||||
this.attachPtyEvents(record);
|
||||
const info = toInfo(record);
|
||||
@@ -196,7 +196,7 @@ export class TerminalService {
|
||||
cwd: options.cwd,
|
||||
cols: options.cols ?? 100,
|
||||
rows: options.rows ?? 30,
|
||||
env: { ...process.env, TERM: "xterm-256color" },
|
||||
env: { ...process.env, TERM: "xterm-256color", IS_PIWEB: "1" },
|
||||
});
|
||||
const requestedName = options.name?.trim();
|
||||
const record: TerminalRecord = {
|
||||
|
||||
Reference in New Issue
Block a user