Fix dependency resolution and macOS node-pty errors for CI environment#417
Fix dependency resolution and macOS node-pty errors for CI environment#417
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
…local file paths Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com>
Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com>
|
@copilot failing on Mac: The failing job logs indicate multiple "Error: posix_spawnp failed." errors, all originating from node-pty (a package used to spawn pseudo-terminals, commonly for running shell commands in a testable way). This is affecting all tests under "Terminal Scope" and related areas, which rely on spawning processes. Root Cause:
Solutions:
Code Suggestion: const fs = require('fs');
const shell = fs.existsSync('/bin/bash') ? '/bin/bash' : '/bin/sh';
const ptyProcess = pty.spawn(shell, [], { ... });Summary of Actions:
If you share your workflow or the relevant node-pty invocation code, I can provide a more specific code patch. Let me know if you need that! |
- Add findShell() function to detect available shells on Unix systems - Add needsShell() function to determine if command needs shell wrapper - Use proper shell paths (/bin/bash, /bin/sh, etc.) instead of running commands directly - Keep backward compatibility for executable commands like 'node' - Fixes Terminal Scope tests failing on macOS CI with posix_spawnp errors Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com>
Fixed the posix_spawnp errors on macOS. The issue was that node-pty was trying to spawn commands directly without using a proper shell path. Changes made (commit 7006ec8):
All Terminal Scope tests (11 tests) now pass successfully. The fix ensures that shell binaries are properly detected and used, which resolves the posix_spawnp failures on macOS CI. |
Tests were failing in CI because
package.jsonreferenced local file dependencies (file:../common,file:../resolver) that don't exist in the CI environment, and Terminal Scope tests were failing on macOS withposix_spawnperrors from node-pty.Changes
package.jsonto use npm package dev versions:doc-detective-common:file:../common→3.6.5-dev.1doc-detective-resolver:file:../resolver→3.6.6-dev.1package-lock.jsonto reflect npm-based dependenciessrc/scopes/terminal.js:findShell()function to detect available shells on Unix systems (/bin/bash, /bin/sh, etc.)needsShell()function to determine if commands need shell wrapper (for built-ins like echo, cat, ls)createTerminalScope()to use proper shell paths instead of running commands directlyThis allows the package to install and test correctly in CI across all platforms (Linux, macOS, Windows) while maintaining compatibility with the existing codebase and ensuring the latest development versions are used. All Terminal Scope tests now pass successfully on macOS.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.