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

No curses! #130

Merged
merged 3 commits into from
May 14, 2015
Merged

No curses! #130

merged 3 commits into from
May 14, 2015

Conversation

vodik
Copy link
Member

@vodik vodik commented May 6, 2015

This patches SIPp to conditionally only enables ncurses if and only if stdout is a tty. This means sipp will now work with its standard out redirected to file, no terminal corruption because of ncurses mode being initialized anyways.

In order to support this, however, the signal handling has to be decoupled from the ncurses support. Hence a slight bit of rewriting and migration of a lot of logic in screen.cpp into sipp.cpp.

@wdoekes
Copy link
Member

wdoekes commented May 7, 2015

Ah, good. That should fix both #96 and #75.

I'll look into this a bit better later. Thanks for the work!

In the mean time, I do see some code style violations (missing spaces around operators, missing space after keywords (if, while), missing braces and enters after single-line ifs). If you could take care of those, that would make the review easier.

@vodik
Copy link
Member Author

vodik commented May 7, 2015

Is there a standard guide somewhere? Yeah, I realized there where violations when I dove in there, but the original code in that area had no standardization anywhere.

Do not initialize ncurses or do any screen clearing unless we have a
tty. The fixes the broken stdout redirection.
@vodik
Copy link
Member Author

vodik commented May 7, 2015

Okay, I cleaned it up a fair bit. The initial patch tried to be as self-contained as possible since the original code base was just soo poorly formatted and confusing. I took some time to up the quality and dropping that dangerous function pointer cast as well.

@vodik
Copy link
Member Author

vodik commented May 7, 2015

Actually, let me do some more work on this. I should move the EXIT_*, the ERROR/WARNING, etc and the sigusr1/2 logic.

@vodik
Copy link
Member Author

vodik commented May 7, 2015

Actually looks like those methods are coupled with screen internals and what was initially throwing me off: screen_sigusr1, is actually an unused definition.

@vodik vodik force-pushed the no-curses branch 4 times, most recently from 32c7c3d to d25c54b Compare May 7, 2015 18:43
Simon Gomizelj and others added 2 commits May 7, 2015 14:45
Move the signal handling out of the ncurses logic so that signals can be
properly handled when curses isn't used (eg stdout redirection).
Logging to an error file requires that ncurses is initialized.
Otherwise rotate_errorf is never called.

Not a perfect fix, a lot of this logic should be decoupled from
_screen_error.
@vodik
Copy link
Member Author

vodik commented May 12, 2015

Okay, as far as I know, this should be complete breaking no functionality. We've been using this patch set internally for some time but we have some different logging code (we write the screen contents out to different files in a log directory) that I'm hoping to also put up for consideration.

wdoekes added a commit that referenced this pull request May 14, 2015
Disables the use of ncurses if stdout is not a tty.

Observe that that mode disables interactive mode key presses. The status screen is shown, but not if you abort prematurely with ^C. Starting without a proper TERM env now works as long as stdout is not a terminal (closes #75). Also closes #96 without the need for an extra command line option.

Thanks @vodik!
@wdoekes wdoekes merged commit fed347b into SIPp:master May 14, 2015
wdoekes added a commit that referenced this pull request May 14, 2015
Disables the use of ncurses if stdout is not a tty.

Observe that that mode disables interactive mode key presses. The
status screen is shown, but not if you abort prematurely with ^C.
Starting without a proper TERM env now works as long as stdout is not a
terminal (closes #75). Also closes #96 without the need for an extra
command line option.

Thanks @vodik!
@wdoekes
Copy link
Member

wdoekes commented May 14, 2015

(fed347b was superseded by c2381c8 -- fixed log message)

Thanks for the patch!

wdoekes added a commit that referenced this pull request May 14, 2015
wdoekes added a commit that referenced this pull request May 14, 2015
@vodik
Copy link
Member Author

vodik commented May 29, 2015

Oh shit, sorry.

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.

2 participants