Sublime Text 3 inconsistently gets stuck using build system - sublimetext3

I am configuring a Sublime Text 3 build system that simply runs a command to flash my embedded micro controller using JLinkExe. My simplified build system is show below.
I have tried to use "cmd" instead of "shell_cmd", both have the same results.
{
"working_dir": "$file_path/..",
"shell_cmd": "JLinkExe -if SWD -speed 4000 -CommanderScript board-release.jlink"
//"cmd": ["JLinkExe", "-if", "SWD", "-speed", "4000", "-CommanderScript", "board-release.jlink"]
}
Expected behavior is to simply run the specified command and show the results in the "Build Results" window. This happens inconsistently but about every 5 times the build works and Sublime shows this:
Script processing completed.
[Finished in 1.5s]
The other approximately 4 tries it doesn't build and Sumblime's build status in the status bar with the Line/Column count hangs for about 5-10 seconds while showing the "Building" text. Then "Building" disappears and nothing shows up in the results window.

Related

Printer Queue in MacOS

I have a LiveCode app standalone that needs to know if there is a job waiting in the MacOS print queue before printing. If app user 1 prints the 2 page report and just one page prints (out of paper) then user 2 comes along and prints the report, the first page out is user 1's report and this is causing mixups. I would like to check the MacOS print queue and prevent printing if there is a job already waiting.
It's not something I've ever needed to do, but I suspect that this capability is not included in LiveCode natively. Instead your best bet will probably be to use LiveCode's shell() function to run a unix terminal command. For instance, lpstat is a command line utility that allows you to query various things about printers connected to your Mac. The following command, run in the MacOS terminal, shows which printers are available and their current status.
lpstat -p
In LiveCode you use the shell() function to call this command line utility, like so:
put shell("lpstat -p") into tPrinterStatus
To find out more about lpstat, open the Terminal and look up the man page:
man lpstat
Lots of options for that utility will appear. There should be one that gives you the information you need.

Display build error in build status page (Jenkins)

I have a freestyle jenkins project which basically just invokes a linux script which writes a long logfile.
If the script fails, then the last line of the logfile will be a human readable description, but I can't add any more build steps to parse it since it's already failed at this point.
Is there an easy way to basically do msg=$(tail -n1 logfile.log) and then display that $msg as a build description in the build status page?
It would make it much easier than having to click on the console output for each build and scroll to the bottom.
I have tried the Customized Build Message plugin which seems like it kind of works, except I can't export the logfile to access from an ENV variable. I also looked at the Console Log Parser, but it doesn't support just getting the last line.

Linux terminal - jump to first line of command output message

After trying to compile my program on Linux, I occasionally get error messages. Sometimes I get a lot needing me to scroll all the way to the top to see where my code broke first. Is there a short cut/faster method to scroll to the first output after I run for example a command like "make file"
I have tried "make file | less", but this chops off the first half of all the error messages, which is the part I am interested in, given that the error messages in the latter half is a result of something not being compiled correctly in the beginning of my file.

Custom sublime build opens up a console

I'm using SublimeText 3 and I've followed this tutorial for opening files in browser. I have in my Chrome.sublime-build file
{
"cmd": ["C:\/Program Files (x86)\/Google\/Chrome\/Application\/chrome.exe", "$file"]
}
All of this works, and my files will be opened in Chrome, which is what I want, but at the same time the console pops up and says
[Finished in 0.1s]
which is super annoying.
Any way to stop console from opening?
I tried adding false as a third argument but that didn't work.
By default, all build systems in Sublime tell you how long it took them to execute. If you don't want that, you need to add the following to your build system:
"quiet": true
Don't forget that all of the parts of the build system need to be separated with commas in order to be valid JSON.

Monitor console output

I have a program, lets call if 'foo'
Foo works fine for a random amount of time during which it announces its progress on the console.
But after sometimes it stops giving any output. At this point I have to manually close the program (ctrl + c) and start it again.
I would like to know if there is a way to monitor console output of a program and in case there is no output for a certain duration of time take some action.
Platform is linux.
I've found this on Internet about a command called watch.
Name
watch - execute a program periodically, showing output fullscreen
Synopsis
watch [-dhvt] [-n ] [--differences[=cumulative]] [--help] [--interval=] [--no-title] [--version]
Description
watch runs command repeatedly, displaying its output (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds; use -n or --interval to specify a different interval.
The -d or --differences flag will highlight the differences between successive updates. The --cumulative option makes highlighting "sticky", presenting a running display of all positions that have ever changed. [...]
watch will run until interrupted.

Resources