mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
Make balena-cli build on refreshed on-prem workers
* Fix 'balena ssh' test cases when using the Windows built-in ssh tool * Fix Windows installer build in new balena CI workers (qqjs patch) * Remove hardcoded path Change-type: patch
This commit is contained in:
parent
6b0201866f
commit
511d0dbe26
@ -20,7 +20,8 @@ import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
import * as shellEscape from 'shell-escape';
|
||||
|
||||
export const MSYS2_BASH = 'C:\\msys64\\usr\\bin\\bash.exe';
|
||||
export const MSYS2_BASH =
|
||||
process.env.MSYSSHELLPATH || 'C:\\msys64\\usr\\bin\\bash.exe';
|
||||
export const ROOT = path.join(__dirname, '..');
|
||||
|
||||
/** Tap and buffer this process' stdout and stderr */
|
||||
|
@ -120,6 +120,13 @@ describe('balena ssh', function () {
|
||||
async function checkSsh(): Promise<boolean> {
|
||||
const { which } = await import('../../build/utils/helpers');
|
||||
const sshPath = await which('ssh', false);
|
||||
if ((sshPath || '').includes('\\Windows\\System32\\OpenSSH\\ssh')) {
|
||||
// don't use Windows' built-in ssh tool for these test cases
|
||||
// because it messes up with the terminal window such that
|
||||
// "line breaks stop working" (and not even '\033c' fixes it)
|
||||
// and all mocha output gets printed on a single very long line...
|
||||
return false;
|
||||
}
|
||||
return !!sshPath;
|
||||
}
|
||||
|
||||
@ -127,11 +134,13 @@ async function checkSsh(): Promise<boolean> {
|
||||
async function startMockSshServer(): Promise<[Server, number]> {
|
||||
const server = createServer((c) => {
|
||||
// 'connection' listener
|
||||
c.on('end', () => {
|
||||
const handler = (msg: string) => {
|
||||
if (process.env.DEBUG) {
|
||||
console.error('[debug] mock ssh server: client disconnected');
|
||||
console.error(`[debug] mock ssh server: ${msg}`);
|
||||
}
|
||||
});
|
||||
};
|
||||
c.on('error', (err) => handler(err.message));
|
||||
c.on('end', () => handler('client disconnected'));
|
||||
c.end();
|
||||
});
|
||||
server.on('error', (err) => {
|
||||
|
Loading…
Reference in New Issue
Block a user