Skip to content

add optional support to replace argv[0] (fixes #472)#627

Open
mattieb wants to merge 7 commits into
microsoft:mainfrom
mattieb:add-argv0-support
Open

add optional support to replace argv[0] (fixes #472)#627
mattieb wants to merge 7 commits into
microsoft:mainfrom
mattieb:add-argv0-support

Conversation

@mattieb

@mattieb mattieb commented Aug 31, 2023

Copy link
Copy Markdown

Fixes #472.

With this, specifying the new property "argv0" in options will replace argv[0] with a custom string.

This is useful, for example, when starting a login shell:

const pty = spawn('/bin/zsh', [], {
  argv0: '-zsh'
});

If this property is omitted, the file parameter is used instead, which is identical to existing behavior.

@mattieb

mattieb commented Aug 31, 2023

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@mattieb

mattieb commented Oct 22, 2023

Copy link
Copy Markdown
Author

Hey y’all, let me know if anything’s missing, but I’ve been using this for quite some time now day-to-day and haven’t seen any issues.

@mattieb

mattieb commented Feb 24, 2025

Copy link
Copy Markdown
Author

Hey folks, sorry for the churn today.

I've been keeping this PR up-to-date with main for 1½ years now, while the code around what I've changed has been evolving.

I've most recently done this because I was running package updates in my project that uses this support and needed to pull in the upgrades y'all have been making.

Is there a chance we could evaluate this relatively simple PR and merge it? I think it's a feature that many folks would find useful.

@Tyriar Tyriar assigned deepak1556 and unassigned Tyriar Dec 19, 2025
@Tyriar Tyriar removed this from the 1.1.0 milestone Dec 19, 2025
@Tyriar

Tyriar commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

@deepak1556 could you review when you get a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

provide a way to control argv[0] of the spawned process

3 participants