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

Terminal: fix nixos wrapped process name #814

Closed
wants to merge 1 commit into from

Conversation

xoltia
Copy link
Contributor

@xoltia xoltia commented Apr 26, 2024

The program currently checks the exeName for the NixOS wrapper name, however the command line name appears normal, while the process name is the one which is in .*-wrapped format. For example, on my system exeName is kgx while processName is .kgx-wrapped.

Currently broken:
image
image

After fix:
image
Screenshot from 2024-04-26 16-33-17

@CarterLi CarterLi closed this in e157b9a Apr 27, 2024
@CarterLi
Copy link
Member

Can you test it? e157b9a

@xoltia
Copy link
Contributor Author

xoltia commented Apr 27, 2024

Can you test it? e157b9a

This does not seem to work as expected. I get gx instead of kgx from .kgx-wrapped.

Using either ffStrbufSubstrAfterFirstC(&result->processName, '.') or ffStrbufSubstrAfter(&result->processName, 0) instead of ffStrbufSubstrAfter(&result->processName, 1) works as expected.

Maybe this is an issue with ffStrbufSubstrAfter?

I noticed for static strings it is inclusive of the character at the provided index, while allocated strings are not (strbuf->chars += index compared to strbuf->chars + index + 1). For example, this code:

FFstrbuf ss;
ss.allocated = 0;
ss.chars = "Hello, world";
ss.length = strlen(ss.chars);

FFstrbuf ds;
ds.allocated = strlen("Hello, world") + 1;
ds.chars = malloc(ds.allocated);
memcpy(ds.chars, "Hello, world", ds.allocated);
ds.length = ss.length;

ffStrbufSubstrAfter(&ds, 1);
ffStrbufSubstrAfter(&ss, 1);

printf("'%s' '%s'", ss.chars, ds.chars);
// 'ello, world' 'llo, world'

CarterLi added a commit that referenced this pull request Apr 27, 2024
@CarterLi
Copy link
Member

Fixed.

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.

None yet

2 participants