Skip to content

Commit

Permalink
Merge pull request #7014 from mook-as/bats/win32/init-process-disappe…
Browse files Browse the repository at this point in the history
…aring

BATS: Try to fix wsl-init.pid not being found
  • Loading branch information
jandubois authored Jun 7, 2024
2 parents 80e0bad + c33e565 commit 83d9770
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
type: string
rd-use-networking-tunnel:
description: Use networking tunnel (on Windows)
default: false
default: true
type: boolean
schedule:
- cron: '0 8 * * 1-5' # 8AM UTC weekdays as a baseline
Expand Down
11 changes: 7 additions & 4 deletions pkg/rancher-desktop/backend/wsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend
*/
protected async runInit() {
const logFile = Logging['wsl-init'];
const PID_FILE = '/var/run/wsl-init.pid';
const PID_FILE = '/run/wsl-init.pid';
const streamReaders: Promise<void>[] = [];

// Delete any stale wsl-init PID file
Expand Down Expand Up @@ -1225,13 +1225,15 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend

while (true) {
try {
await this.execCommand({ expectFailure: true }, 'test', '-s', PID_FILE);
const stdout = await this.captureCommand({ expectFailure: true }, 'cat', PID_FILE);

console.debug(`Read wsl-init.pid: ${ stdout.trim() }`);
break;
} catch (e) {
console.debug(`Error testing for wsl-init.pid: ${ e } (will retry)`);
}
if (Date.now() - startTime > maxWaitTime) {
throw new Error(`Timed out after waiting for /var/run/wsl-init.pid: ${ maxWaitTime / waitTime } secs`);
throw new Error(`Timed out after waiting for /run/wsl-init.pid: ${ maxWaitTime / waitTime } secs`);
}
await util.promisify(setTimeout)(waitTime);
}
Expand Down Expand Up @@ -1467,7 +1469,8 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend
LOG_DIR: logPath,
});
await this.writeFile(`/etc/init.d/buildkitd`, SERVICE_BUILDKITD_INIT, 0o755);
await this.writeFile(`/etc/conf.d/buildkitd`, SERVICE_BUILDKITD_CONF);
await this.writeFile(`/etc/conf.d/buildkitd`,
`${ SERVICE_BUILDKITD_CONF }\nlog_file=${ logPath }/buildkitd.log\n`);
}),
this.progressTracker.action('Proxy Config Setup', 50, async() => {
await this.execCommand('mkdir', '-p', '/etc/moproxy');
Expand Down

0 comments on commit 83d9770

Please sign in to comment.