Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing process.title does nothing #14255

Open
brownjoel opened this issue Sep 30, 2024 · 8 comments
Open

Changing process.title does nothing #14255

brownjoel opened this issue Sep 30, 2024 · 8 comments
Labels
bug Something isn't working confirmed bug We can reproduce this issue good first issue Something that would be good for new contributors node:process

Comments

@brownjoel
Copy link

What version of Bun is running?

1.1.29+6d43b3662

What platform is your computer?

Darwin 23.5.0 x86_64 i386 and Linux 6.8.0-40-generic x86_64 x86_64

What steps can reproduce the bug?

Run

bun -e "process.title='foo'; console.log(process.title)"

What is the expected behavior?

foo to be printed to the console.

What do you see instead?

bun is printed to the console.

Additional information

If run with node 20, this works as expected:

% node -e "process.title='foo'; console.log(process.title)"
% foo
Welcome to Node.js v20.11.0.
Type ".help" for more information.
> process.title='foo'
'foo'
> console.log(process.title)
foo

In bun:

Welcome to Bun v1.1.29
Type ".help" for more information.
[!] Please note that the REPL implementation is still experimental!
    Don't consider it to be representative of the stability or behavior of Bun overall.
> process.title='foo'
'foo'
> console.log(process.title)
bun

Tested on a variety of machines, including macOS and Ubuntu.

@brownjoel brownjoel added bug Something isn't working needs triage labels Sep 30, 2024
@dylan-conway dylan-conway added node:process good first issue Something that would be good for new contributors and removed needs triage labels Oct 1, 2024
@dylan-conway
Copy link
Member

This is a bug in src/bun.js/bindings/exports.zig. Process.setTitle/getTitle should be saving input titles.

@CarlosEduR
Copy link

@dylan-conway nice, thanks for adding the labels! as this is a good first issue, I wanna take a look!

@brownjoel
Copy link
Author

Related (and I'm sorry this wasn't clear enough in the original ticket):
Will a fix to this affect the actual process' title, as it does in node? I'm less concerned that the field process.title is retained and more that this field is a mechanism for creating clear and known process titles for which other processes can interact.
e.g. copied from the Node docs:

Assigning a new value to process.title modifies the current value of ps.

@CarlosEduR CarlosEduR mentioned this issue Oct 11, 2024
6 tasks
@RiskyMH RiskyMH added the confirmed bug We can reproduce this issue label Nov 20, 2024
@RiskyMH
Copy link
Member

RiskyMH commented Nov 20, 2024

I find it interesting how this works on windows but not linux (normally its the other way around).

@RiskyMH
Copy link
Member

RiskyMH commented Jan 8, 2025

This appears to work now! Probably from #16026 by @nektro.

Edit: seems to be only the variable change, not actually changing the title.

@RiskyMH RiskyMH closed this as completed Jan 8, 2025
@Jarred-Sumner Jarred-Sumner reopened this Jan 8, 2025
@Jarred-Sumner
Copy link
Collaborator

This isn’t implemented yet on posix

@nektro
Copy link
Member

nektro commented Jan 8, 2025

❯ bun-debug --version
1.1.42-debug

❯ bun-debug -e "process.title='foo'; console.log(process.title)"
foo

❯ uname -a
Darwin Mac 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031 arm64

@Jarred-Sumner
Copy link
Collaborator

@nektro the purpose of process.title is not to add a getter/setter called process.title

the purpose of process.title is to impact how it appears in Activity Monitor, in top, in htop, and to other applications

We cannot mark this issue as fixed until process.title does what it was designed to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed bug We can reproduce this issue good first issue Something that would be good for new contributors node:process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants