Change terminal title of Crystal program

Hello, actually my cli crystal program work fine, but I just would like to change something.

When my program is running, I would like my program sometimes change the terminal title. How can I do that ? For example when my program is installing some software, I would like a title like : ISM ( 1 / 279)

I don’t find anybody having done it yet, so you would probably want to bind setproctitle(3). Portability of that doesn’t seem immediately clear and obvious either, so could even make a nice little shard to abstract any various OS specific ways of doing that.

1 Like

Here’s what Ruby is using as fallback implementation, apparently stolen from OpenSSH :D, for systems that don’t support setproctitle(3) which depending on availability tries to do it via pstat (that’s a Windows library call I guess?) and finally by overwriting argv[0].

1 Like

Okay, but because it’s unavailable for Crystal at the moment, wich way I need to use to do that ? :no_mouth:

My software is for Linux only

It’s a C function so you would need to create a C binding.

1 Like