Extendscript write to stdout or stderr - extendscript

I'm running an Adobe After Effects project via subprocessing and I'm trying to find a way to write to Stdout or Stderr from within AE, so that I can communicate to the parent process. In other words, is there any way to write to Stdout from Extendscript?
Yes I do know about $.writeln() but that writes to the Extendscript Toolkit console, not stdout and is therefore unreadable by another process.

A little late but yes. There is a writeConsole() global function... So you use that instead of the one within $. Also there are write() and writeLn() global functions that write to info panel.

Related

View output of process redirected to dev/null - undo redirection

I've pushed a couple of process to background and redirected the output to /dev/null. I want undo that and see what's happening since its been in the background for a long time.
Is there a way to undo the > /dev/null redirection and bring the process to foreground?
I think you question would be better posted on unix.
There, you can find How to change the output redirection of a running process?, which exactly your question casted in a more general form.
From the answers, and from the 3rd party tool (redirect) suggested in the accepted answer by its creator, which is mostly written in C, I deduce that there's no shell-only way to accomplish what you want.
However that question is from 2012, so you might want to ask a new one to see if something changed in the meanwhile.
Last but not least, doing some search in man bash I've found the Coprocesses section, that reads
[…] A coprocess is executed asynchronously in a subshell, as if the command had been
terminated with the & control operator, with a two-way pipe established between
the executing shell and the coprocess. […] The standard output of command is
connected via a pipe to a file descriptor in the executing shell, and that
file descriptor is assigned to NAME[0]. The standard input […]
which is probably a way to launch processes in background without losing the ability to change their file descriptors, if I interpret the quote correctly.

How to switch stdin dynamically? -> radare2

i'm aware the it is possible to set the stdin to the content of file defined in the project profile. What i'd want though, is the ability to change the stdin while debugging. Is there any way to do this on a linux system?
Basically i need this because my next input to debuggee is depending on one of it's former outputs. This means i'm unable to set the right stdin content before i start debugging.
In fact i need to set it while i am debugging!
Thank you very much!

How to direct program prints to seprate window(shell/tty)

I am writing a console application which is using some library in which (DEBUG) prints are enabled. In my main() application I am taking inputs from user. I want this user input to be separate from my library prints. I cant disable library debug prints. (The problem is library has lots of continuous prints over which it is difficult to take user input. Can I do something like creating a new tty for taking user inputs. )
dup2(2,3p) lets you duplicate an existing file descriptor (such as the one you just opened on /dev/null) onto another existing file descriptor (such as FD2, stderr). So, open /dev/null for writing and clobber stderr with it.
Don't forget to add an option to disable this though, in case you need to debug.

In VC++, how to access text continuously from console window and print it in a CListBox?

In VC++, how to access text continuously from console window and print it in a CListBox? Infact I have a MFC program which calls other FORTRAN exe. The output of the FORTRAN exe comes in the console window. I need to print it in a CListBox continuously. I can print it in a file and can print it at one shot. But that is not my purpose. I need continuous feed. Can any one help me out of this?
_popen may work for you, see http://msdn.microsoft.com/en-us/library/96ayss4b%28VS.80%29.aspx
This Microsoft article should get you most of the way there:
How to spawn console processes with redirected standard handles

Mount executable as file on Linux/Unix filesystem

Is it possible to make an executable look like a read-only file on Linux, such that opening the "file" for reading actually executes the file and makes its stdout available for reading as if it were data in the "file"? It should be openable by any program that knows how to open a file for reading, for example 'cat'.
Look at popen. Basically what you are describing is a pipe.
P.S. If you need language specific help, edit the question and add the language/environment you're working in and I'll try to provide more specifics.
Use FUSE
On unix-like OS's you can send the output of a program to a named pipe that is opened by another program. Look at the mkfifo command to create the named pipe. The named pipe works a lot like a file, with some limitations. For example, it is not seekable.
Seems like you could pipe the output of the program into whatever you are using to "read". The problem is if you want to open the executable in say emacs or vim or whatever, it's not a matter of the executable so much as the editor doesn't know any other way to interpret it.

Resources