zed-local: add --stable flag to zed-local (#10165)

`--stable` makes all clients except for the first one use a stable
version of Zed (hardcoded to `/Applications/Zed/Contents/MacOS/zed` for
now).

That should make testing cross-channel collab changes a bit easier. /cc
@maxbrunsfeld @ConradIrwin

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-04-04 15:26:41 +02:00 committed by GitHub
parent 27165e9927
commit 7d1a5d2ddf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,7 @@ OPTIONS
--release Build Zed in release mode
-2, -3, -4, ... Spawn multiple Zed instances, with their windows tiled.
--top Arrange the Zed windows so they take up the top half of the screen.
--stable Use stable Zed release installed on local machine for all instances (except for the first one).
`.trim();
const { spawn, execFileSync } = require("child_process");
@ -29,6 +30,7 @@ const DIGIT_FLAG_REGEX = /^--?(\d+)$/;
let instanceCount = 1;
let isReleaseMode = false;
let isTop = false;
let othersOnStable = false;
const args = process.argv.slice(2);
while (args.length > 0) {
@ -44,6 +46,8 @@ while (args.length > 0) {
} else if (arg === "--help") {
console.log(HELP);
process.exit(0);
} else if (arg === "--stable") {
othersOnStable = true;
} else {
break;
}
@ -123,8 +127,11 @@ setTimeout(() => {
row * instanceHeight + titleBarHeight,
].join(",");
const size = [instanceWidth, instanceHeight].join(",");
spawn(zedBinary, i == 0 ? args : [], {
let binaryPath = zedBinary;
if (i != 0 && othersOnStable) {
binaryPath = "/Applications/Zed.app/Contents/MacOS/zed";
}
spawn(binaryPath, i == 0 ? args : [], {
stdio: "inherit",
env: {
ZED_IMPERSONATE: users[i],