How to get application error with MonkeyRunner? - monkeyrunner

The "Force close" or "ANR" pop up when MonkeyRunner is running.
How MonkeyRunner get the "Force close" or "ANR" error and stop script.
Thank you very much.

If you have monekyrunner open you need to use ctrl+d to stop it. If you are using a script then you need to use sys.exit(1). (you'll need to import sys)
To see if you got a force close you will need to use subprocess to make a subprocess to monitor the log for force closes.

Related

Minecraft console get wrong commands

I started a local server and want to add some simple commands with python, the server is running with forge 1.12 and a couple of mods.
My idea was it to catch wrong commands and send the right result instead.
An easy test command would be /echo Hello World with the result in the chat Hello World.
To get the command I am using the last line of the latest console log file, which is equal to the current console content. But in the console I cant read wrong commands. So if I run the echo command I get an message in the chat Unknown command. Try /help for a list of commands.
I think there could be two solutions:
Add in any register the command to get it in the console, prevent on this way the server to response and get the command in the console to use it.
Find a config to print also wrong commands in the console.
Thanks for helping
There is no way to 'cancel' commands through API, but there is a trick to effectively cancel commands anyways. You want to be listening to the Forge CommandEvent, modifying the command to another existing command that does nothing (you can create one yourself). This gives you a place to handle all commands (you'll have to filter for unexisting commands, otherwise you'd cancel all commands), and it will prevent the Unknown Command message from showing.

How not to print Qt internal messages on console?

I have a program that functionally works well, but it prints messages on console like:
QObject::startTimer: Timers cannot be started from another thread error
Is there a way to configurate it, so it does not print them anymore?
Regards

Q: User termination of a script leads to loss of logs?

I've been trying to terminate my scripts but I've found that I usually lose these logs and I don't know why. Specifically they are the .xml, .log, and .report files that are produced after the running of a script. Is there someway I can ensure that the logs aren't deleted?
Looks like you are pressing CTRL+C Twice, making it force exit from test run. If you press once, it will create logs.

How to stop hiredis command?

I am using hiredis library in my project. I'm using async API. I schedule a read command and wait for data. That works fine. However problem occurs when I try to close the connection - I call redisAsyncDisconnect, however the callback routine isn't called until I receive data.
Is it possible to cancel the read operation? How? Or is there a way how to force close the connection?
The answer is clear now - redisAsyncFree does what I need - stops all commands and calls redisAsyncDisconnect.

How to run system() command in R script

I have a local server insalled on my system and have to start that from within my R function.
here is how I start it:
cmd<-"sh start-server.sh"
system(cmd, wait=FALSE)
I have to perform computations after starting the server. Basically my function has to start the server and proceeds with further steps.
The server starts but the further steps of the program are not executed.The cursor keeps waiting after the server is started.
Please suggest how to go about this.
My problem is finally solved. I had to add Sys.sleep() and it runs after waiting for few seconds. Thank you for help.
You need to determine whether or not the problem is with the server script or with R's execution of the script. Try:
Running sh start-server.sh directly from a command prompt and seeing what happens.
Running something simple via R's system function, e.g., system("ls", wait = FALSE).
By default, system waits for the executed command to terminate before returning. Add wait=FALSE if you want it to return immediately.

Resources