Highlight errors in Terminal - ruby

I had a problem with Terminal a Jekyll install but I didn't spot the site being not-uploaded to the server by rsync because I didn't see an error in the output. So, I was wandering:
Is there any way to make Terminal detect errors and give them a specific color?
My error here was:
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
It had other things, but if this line was highlighted, I would have spotted it way earlier.

Generally speaking, color output is a responsibility of a program and not a terminal.
For example, clang compiler produces colorful error and warning messages.
If the application you are using does not support this, the only option is to create a wrapper and parse its output, highlighting errors in different color. This approach is taken by colorgcc, for instance, to make GCC compiler output in colors.
Perhaps you can grab that script and adjust it for your needs? Check it out here - https://github.com/colorgcc/colorgcc
Also, if there are errors, the app should probably exit with non-zero exit code. It might be a good idea to check it and write an even bigger and noticeable message upon exit in case of errors.
Hope it helps.
Good luck!

You can enable highlighting of errors for one command with the hilite utility. It only works for commands you type hilite for – it isn’t enabled globally – but it’s still useful if you know or suspect that a command outputs errors and you want to locate them. So when you build with jekyll, you could do any of the following:
Change jekyll … to hilite jekyll … in your build script
Try to remember to always type hilite before jekyll
Run jekyll normally, but if its output or exit code makes you suspect you got errors, run it again with hilite to locate them
On OS X, you can install hilite with Homebrew using brew install hilite.

Related

EZBounce Make error

I am trying to install ezbounce on an SSH Shell. (Host has OK'ed use of the bouncer)
(I do NOT have sudo, however, my host is lenient and I can get things ran. If possible, I prefer a solution that does NOT require sudo or equivalent.)
I have finished ./configure , and am on the make step.
when I go to make the file, it errors with the following:
https://pastebin.com/YetM6nGN
I found a possible solution to the problem here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219298
The solution seems to be centered on the fact that GCC++/GNU make calls its latest version as opposed to the newer one.
They have an included patch, but I am honestly clueless how this gets applied.
Any help fixing the error via here or directly editing the makefile is greatly appreciated.
My makefile: https://www.dropbox.com/s/u75toiigd4v5wgl/Makefile?dl=0
So I had some help from an external source (Thank you discord communities!)
The patch listed above is for FreeBSD ONLY! (As I was made aware)
For Non-FreeBSD Ports, the fix (if your makefile looks like mine) is to edit line 32 to the following: CXX_OPTIMIZATIONS = -std=gnu++98 -O2
There is some error looking items in console that follows, but the build is successful, so I'm gonna assume they are moot.
It honestly was a confusing little puzzle for your average user, but there ya go :)

How do I make chromedriver suppress errors and warnings?

When using chromedriver 2.29 and watir-webdriver to drive a chrome browser on Windows 7 during automated tests or using IRB(interactive ruby shell) I constantly see errors and warnings written to standard output while the browser is in use.
Errors like this:
ERROR:gl_surface_egl.cc(690)] eglInitialize D3D11 failed with error EGL_NOT_INITIALIZED, trying next display type
This makes it difficult to use IRB because of the error text constantly getting in the way. It also makes test output in rspec really problematic and hard to read because of all the NOISY ERRORS/WARNINGS.
How can all these errors be silenced? I've tried to load up the browser with the --silent option that chromedriver has and this hasn't stopped the errors.
Updated to latest:
Chrome: Version 60.0.3112.78 (Official Build) (64-bit)
AND chromedriver: version 2.30
No longer seeing the issue.
Well if you want to ignore these errors you can use exceptions to ignore all the errors, you can read about how to do this here if you don't already know: https://www.tutorialspoint.com/ruby/ruby_exceptions.htm
If you want to keep the errors but make less clutter I would either write the errors to an error log file or write the text to an output log file.
Hope this helped!

Plotting with Maxima and Pango error

I've been running Maxima on my iMac with Sierra. I just tried doing some examples to learn about plotting. When I try to make a plot with the plot2d command I get my plot but there are no labels, no numbers on my axis and no title. No text at all. I also get a series of error messages related to a module called Pango.
The error messages are:
(process:11388): Pango-CRITICAL **: No modules found:
No builtin or dynamically loaded modules were found.
PangoFc will not work correctly.
This probably means there was an error in the creation of:
'/opt/mac/quartz-new/etc/pango/pango.modules'
You should create this file by running:
pango-querymodules > '/opt/mac/quartz-new/etc/pango/pango.modules'
(process:11388): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderCoreText', script='common'
(process:11388): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderCoreText', script='latin'
Does anyone know how to resolve this. It only happens with inline plots. If I use the wxmaxima menu for plotting and send it thru GNUPLOT I avoid this issue.
I don't have a Mac so I haven't tried these commands; I found this info via a web search. I hope it works for you.
It appears that the Pango library is not installed. Searching the web seems to show that installing it is simple: http://brewformulas.org/Pango
That method requires a package manager named Homebrew. If that is not already installed, you'll need to install Homebrew first and then Pango. See: http://macappstore.org/pango/

Need some help creating an audiosprite through cygwin/node.js on Windows 7

I'm trying to make an audiosprite, but somehow I'm overlooking some basic thing somewhere, and I can't for the life of me find out what it is, googling around on the error I'm getting gets me 100's of unrelated results, so I'm sorta hoping somebody here can help me along.
I'm running on 64bit Windows 7 Pro, I've just installed the latest Cygwin (1.7.32) and Node.JS (0.10.32) for 64bit half an hour ago, and now I'm trying to actually use them, but I'm running into issues.
At first I thought (hoped) a simple restart would resolve things, but sadly it doesn't, I've also checked the PATH variable, and it has npm listed, so that's not it either.
here's what I'm doing, and getting:
olivier#MV-VFX-01 ~
$ cd audiosprite-stuff/
olivier#MV-VFX-01 ~/audiosprite-stuff
$ audiosprite *.mp3
cygwin warning:
MS-DOS style path detected: C:\Users\olivier\AppData\Roaming\npm/node
Preferred POSIX equivalent is: /cygdrive/c/Users/olivier/AppData/Roaming/npm/node
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
olivier#MV-VFX-01 ~/audiosprite-stuff
$
So first I'm browsing to a directory (inside home/olivier) that has the mp3's I want to bake an audiosprite with.
After that I simply try the most basic possible audiosprite cmd, that should create an audiosprite from all mp3's in the current directory.
Overlooking the warning (least of my worries atm, and I can always fix that later) the return message from audiosprite is
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
The issue is that I really don't know what to make of the above, like I said when I googled on (parts of) the error, I got completely random results, none related to audiosprite, and the ones that did relate to Cygwin had fixes for specific pieces of code, but not a general fix, which is kind of what I'm needing.
Does anybody have any clue what I'm missing here? do I need to add more stuff to my PATH variable perhaps? (at the moment it only mentions npm in the PATH variable, nothing else)
I've already tried some obvious things like running cygwin as administrator and even tried using 'command prompt' instead of cygwin, and while it does support all the cmds, I get the exact same errors there.
Actually, im just incredibly stupid..
I forgot to install FFMPEG, so ofc it couldnt make an audiosprite, durrrrr.
Resolved :)

Ruby eventmachine error: 'no loop breaker'

I get a slightly heisen error from eventmachine (0.12.10, on OSX 10.6.4):
terminate called after throwing an instance of 'std::runtime_error'
what(): no loop breaker
It only occurs in tests, and only when all tests are run together. Run individually they pass.
I spotted the only place in the eventmachine code that mentions the error's message:
http://github.com/eventmachine/eventmachine/blob/master/ext/em.cpp#L333
(What puzzles me as well is that it looks like a win32 code path, or am I wrong?)
To me it looks like some ressource like sockets are used up. That would explain the occurence pattern.
Ok, I found it myself.
The error comes in fact from the win32 conditionally compiled code. I get a plain old "Too many open files" error if I build locally, and that problem is easy to releave by increasing the ulimit value for open files (which is said to be quite modest by default on OSX).
ulimit -n 1024 # or whichever value you find appropriate
(Default is 255, look at the output of ulimit -a)
If I build and install from the cloned git repository using rake gem:install, I get the expected (Unix) error message. So the bug appears to be fixed in master.
Filed bug for the rubygems.org gem is here: http://github.com/eventmachine/eventmachine/issues#issue/88

Resources