-
Notifications
You must be signed in to change notification settings - Fork 24
Description
When the user types list_screens(), new instances of already existing Screen instances are returned. This is a problem, because if a user has enabled logs in a screen session, the user will not be able to get the logs from Screen instances returned by list_screens(). Here is an example scenario when the user is trying to disable and delete logs for all current screen sessions:
scr1 = Screen('scr1', True)
[detached]
There is a screen on:
46165.scr1 (Detached)
There is no screen to be detached matching 46165.
list_screens()
[<Screen 'scr1'>]
scr1.enable_logs('scr1.log')
screen_list = list_screens()
screen_list
[<Screen 'scr1'>]
for i in range(0, len(screen_list)):
... screen_list[i].disable_logs(True)
...
Traceback (most recent call last):
File "", line 2, in
File "screenutils/screen.py", line 104, in disable_logs
system('rm ' + self._logfilename)
TypeError: cannot concatenate 'str' and 'NoneType' objects
In the example above, the user created a Screen with name 'scr1' and a log file with name 'scr1.log'. But when using the Screen instance returned from list_screens(), the user is unable to delete the log file, because list_screens() creates new instances of an already existing Screen. This shouldn't be allowed. list_screens() should return references to already existing instances of Screen.