Skip to content

Commit 1404757

Browse files
committed
Add moving prebuilt conpty binaries
1 parent 0ad069d commit 1404757

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/copy-prebuilds.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,34 @@ for (const file of BUILD_FILES) {
2626
if (fs.existsSync(file)) {
2727
fs.copyFileSync(file, path.join(PREBUILD_DIR, path.basename(file)));
2828
}
29+
}
30+
31+
console.log(`\x1b[32m> Moving conpty.dll...\x1b[0m`);
32+
if (os.platform() !== 'win32') {
33+
console.log(' SKIPPED (not Windows)');
34+
} else {
35+
let windowsArch;
36+
if (process.env.npm_config_arch) {
37+
windowsArch = process.env.npm_config_arch;
38+
console.log(` Using $npm_config_arch: ${windowsArch}`);
39+
} else {
40+
windowsArch = os.arch();
41+
console.log(` Using os.arch(): ${windowsArch}`);
42+
}
43+
44+
if (!CONPTY_SUPPORTED_ARCH.includes(windowsArch)) {
45+
console.log(` SKIPPED (unsupported architecture ${windowsArch})`);
46+
} else {
47+
const versionFolder = fs.readdirSync(CONPTY_DIR)[0];
48+
console.log(` Found version ${versionFolder}`);
49+
const sourceFolder = path.join(CONPTY_DIR, versionFolder, `win10-${windowsArch}`);
50+
const destFolder = path.join(PREBUILD_DIR, 'conpty');
51+
fs.mkdirSync(destFolder, { recursive: true });
52+
for (const file of ['conpty.dll', 'OpenConsole.exe']) {
53+
const sourceFile = path.join(sourceFolder, file);
54+
const destFile = path.join(destFolder, file);
55+
console.log(` Copying ${sourceFile} -> ${destFile}`);
56+
fs.copyFileSync(sourceFile, destFile);
57+
}
58+
}
2959
}

0 commit comments

Comments
 (0)