hoaproject / Console

The Hoa\Console library.
https://hoa-project.net/
366 stars 32 forks source link

Detect when we are running in screen #56

Open jubianchi opened 9 years ago

jubianchi commented 9 years ago

I don't actually know if screen may cause similar bugs as tmux but perhaps it might be useful to check if we are running in it.

Just like we did for tmux with Console::isTmuxRunning I think we should introduce Console::isScreenRunning.

Even if adapting escape sequences is not required when we are in screen I think this method will still be useful for developers to know from their code if the users is inside a multiplexer.

See here for the original discussion: https://github.com/hoaproject/Console/pull/53#issuecomment-144386528

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/27215261-detect-when-we-are-running-in-screen?utm_campaign=plugin&utm_content=tracker%2F459935&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F459935&utm_medium=issues&utm_source=github).
Jir4 commented 9 years ago

Why not checking Console::isMultiplexerRunning ? I don't think implementing a method for each multiplexer is the good way to do that.

Hywan commented 9 years ago

@Jir4 Correct but we have to deal with each multiplexer… So maybe we should go for Console::isMultiplexerRunning and Console::getMultiplexerName? That's a strange API too…

Thoughts?

Jir4 commented 9 years ago

@Hywan Is it the name really important ? Does something change for each multiplexer ( when we copy for instance ) ?

I don't see all impacts of multiplexers on Hoa\Console

jubianchi commented 9 years ago

@Jir4 @Hywan I would go for something like Console::isRunningInsideMultiplexer which would just be an helper method for developers using Hoa/Console:

public function isRunningInsideMultiplexer() {
    return static::isTmuxRunning() || static::isScreenRunning();
}

This would ease the use of this check but still allow us to do isolated internal checks.

Jir4 commented 9 years ago

:+1:

Hywan commented 9 years ago

:+1:

Hywan commented 9 years ago

Do we agree that this is for private usages, while the visibility will be public I guess.

Hywan commented 7 years ago

Any PR?