Platform Difference when launching non-existing Commands

Open
#689 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
node.js, typescript

Research direction

Start at the spawn entry point in lib/index.js and compare the Windows path shown in lib/windowsPtyAgent.js and lib/windowsTerminal.js with the Linux behavior for the nonexistent gurkensalat command. Determine how failure is reported on each platform; done means the behavior or reliable failure-detection contract is clearly defined and covered for both Linux and Windows.

Written by the indexing model from the issue text.

Description

bug

Environment details

  • OS: Linux/Window
  • OS version: Ubuntu 22, Windows 11
  • node-pty version: 1.0.0

Issue description

The following program behaves very differently on Windows vs. Linux:

const pty = require('node-pty');


const process = pty.spawn('gurkensalat', [], {});

console.log(`process pid = ${process.pid}`);

On Windows, this program throws an Error

C:\Users\thomas\code\EclipseSource\theia\node_modules\node-pty\lib\windowsPtyAgent.js:80
            term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor);
                                   ^

Error: File not found:
    at new WindowsPtyAgent (C:\Users\thomas\code\EclipseSource\theia\node_modules\node-pty\lib\windowsPtyAgent.js:80:36)
    at new WindowsTerminal (C:\Users\thomas\code\EclipseSource\theia\node_modules\node-pty\lib\windowsTerminal.js:51:24)
    at Object.spawn (C:\Users\thomas\code\EclipseSource\theia\node_modules\node-pty\lib\index.js:29:12)
    at Object.<anonymous> (C:\Users\thomas\code\EclipseSource\theia\packages\process\foo.js:4:21)

whereas on Linux it prints a pid.

I think I remember that in previous versions, the spawn call would fail for Linux also. Is there a way to still detect those failures on Linux reliably?

Dominant language
TypeScript
Stars
2k
Forks
337
Avg merge
21h 58m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/node-pty

All issues in microsoft/node-pty

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.