How do I redirect Tornado shell ouptput?

In Tornado ,we can’t copy data from the terminal. And, as the data increases, the previous data is overwritten.

So,How do I redirect Tornado shell ouptput?

After trying many methods, I found one that worked.

The main code as follows

file = open("file.txt", 0x102, 0777)
cur = ioGlobalStdGet(1)
ioGlobalStdSet(1, file)
/*
// your code
*/
ioGlobalStdSet(1, cur)

In the above code, you first open a file that redirects the output data. Then save the current output path. Then set the path of the standard output to the open file, and restore the original path of the standard output after the execution of the code to be tested.

In addition, it is effective against the 2.1 version of tornado. It is up to readers to verify whether the later version of tornado will work.

Header file:ioLib

你可能感兴趣的:(tornado,python)