You are not logged in.
I'm trying to set the width in a detached Gnu screen session so a script can catch the output with tail. When the session spawns it's width is too small and lines get wrapped and the script can't get the lines correctly.
I have tried using screen - X width -w 1000 and it dosen't work. I have also tried to set defwrap to off in the .screenrc file with no success.
The only way I can archive this is to manually attach to the screen session and use ctrl+a, : and use the width -w 1000 command.
Can this be done? And how?
Any help is appreciated.
The Linux philosophy is 'Laugh in the face of danger'. Oops. Wrong One. 'Do it yourself'. Yes, that's it.
Offline
This sounds very much like a X-Y Problem.
Some programs offer switches, but I have no clue what case you are trying to solve or what you want to achieve.
Offline
width [-w|-d] [cols [lines]]
Toggle the window width between 80 and 132 columns or set it to cols columns if an argument is specified. This requires a capable terminal and the termcap entries "Z0" and "Z1"
If the session is not attached to a terminal, then obviously there is nothing to resize. The pseudoterminal maintained by the detached screen session does not have a width as there is no physical device. It just has input and outputs to file descriptors.
I agree with the above, the "width" is not the source of your problem. Describe what is actually happening.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Alright, quick rundown:
Running a Windows-only available game server within a wineconsole, within the screen so I can access the console if I need to type in something myself. The wine prefix is running on a ramdisk and has scheduled rsync to sync to hdd. Now I made a server script that sends the save command (to save the world) to the console and then listens with tail for the correct string in the screen log and after that syncs the files (so it dosen't sync a half made save). All this works fine but if I want to listen for other events that have long line outputs then it dosen't work.
Either because I log in from my phone now and then to check on things and the screen session resizes to my phone's screen and is preserved after detach.
Second is the screen log. When I start up a normal session (with wrap off) the output looks like this:
Something
Somewhere
SomewhatBut if I attach the screen and issue width -w 1000 to it the output log looks like this (and stays like this after I detach):
Something
Somewhere
SomewhatThe general problem is that this happens:
This is a server resp
onseHope this explains it. If not let me know if you need more details.
Last edited by 7thCore (2019-09-27 12:31:34)
The Linux philosophy is 'Laugh in the face of danger'. Oops. Wrong One. 'Do it yourself'. Yes, that's it.
Offline
Why are you not hooking your scripts stdin to your programs stdout, without screen in the middle?
tee it out into the screen session, or a log file and tail that from screen, but don't make screen the primary point of relevance. (All of this not withstanding that even just monitoring a stdout stream of log files to make decisions is probably not the most sane approach in your usecase...)
Offline
"Something", "Somewhere", and "Somewhat" are far to vague to have a meaningful discussion about - and I'm not sure why you feel the need to obscure the actual issue. Further the difference between your first and second fictional output is not width, but extra newlines - so I have no idea how that is even supposed to represent your problem.
In any case, I suspect the problem is wineconsole is wrapping lines as it tries to shrink itself to the last containing device.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
What I'm trying to say is that the log has tabs/spaces that wrap.
If you want to see the files for yourself and the diffrence in them I can compress them and upload them to a site of your choosing and link it here.
One with the width setting and one without.
Last edited by 7thCore (2019-09-27 13:35:09)
The Linux philosophy is 'Laugh in the face of danger'. Oops. Wrong One. 'Do it yourself'. Yes, that's it.
Offline
Well you guys are right about the pseudoterminal situation. However I will be switching to tmux seeing i can set hooks so I can set it so when a small screen device attaches it resizes the width automaticly.
The Linux philosophy is 'Laugh in the face of danger'. Oops. Wrong One. 'Do it yourself'. Yes, that's it.
Offline