I am using following code to execute process and capture stderr/stdout:
proc = window.cep.process.createProcess('/path/to/nodejs','/path/to/script.js');
// proc.data is a PID
And here is my script.js:
For some reason only the first line ('abcdef') is printed by stdout handler (handler is called only once)... Next lines are ignored and callback is never called again. What I am doing wrong?
Adobe Photoshop Version: 14.2 (14.2 20131211.r.515 2013/12/11:23:00:00) x64
Operating System: Mac OS 10.9.1
There is nothing wrong in your code. This is a limitation of cep.process.stdout/stderr which is targeting to capture one time of stdout/stderr output. For now, two workarounds are suggested as the following.
a. Embed cep.process.stdout/stderr, like the code below
b. Join all stdout output as one, like
var str1 = 'abcdef';
var str2 = '12345';
var str3 = 'gghhtt';
console.log(str1 + str2 + str3);
Besides, the good news is since CEP5, nodejs is integrated into CEP and your script could be executed in Html engine of CEP directly. My guess is Photoshop 15.0 will probably pick up CEP5 to involve the benefit in. Kindly let me know if you need more information.