No such device or address: '/dev/stdout'

一笑奈何 提交于 2019-12-11 06:56:07

问题


I'm executing a python script from within node using execSync like this:

execSync('python myScript.py -o "/dev/stdout"');

My script will send the result to the file specified at -o in this case /dev/stdout.

I get the error message "No such device or address: '/dev/stdout'".

If I execute the command manually from the terminal it runs fine, but not when started via node.

I'm running Ubuntu 12.04.


回答1:


When you run the command in a terminal, /dev/stdout redirects to the terminal stdout. When you spawn the python process with execSync there's no place for stdout to be redirected to.

If you read a bit further down the execsync page, it describes how to use a child process' stdout



来源:https://stackoverflow.com/questions/40288461/no-such-device-or-address-dev-stdout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!