考虑以下情况:
main.c
#include<stdio.h>
int main(){
fprintf(stdout, "STDOUT: I belong to stdout\n");
fprintf(stderr, "STDERR: I belong to stderr\n");
return 0;
}
test.launchd.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>test.launchd.plist</string>
<key>Program</key>
<string>/path/to/the/compiled/binary</string>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/err</string>
<key>StandardInPath</key>
<string>/tmp/in</string>
<key>StandardOutPath</key>
<string>/tmp/out</string>
<key>WorkingDirectory</key>
<string>/tmp</string>
</dict>
</plist>
我在 / tmp / err 文件中得到STDERR: I belong to stderr
,但在 / tmp / out 文件中没有STDOUT: I belong to stdout
。这是已知错误还是我做错了什么?
我正在运行macOS 10.14.4 beta 3。