Re: Mac OS crash, details inside...
On Jun 14, 2013, at 2:49 AM, Gary Willoughby d...@kalekold.net wrote: In fact i have the same problem reading files too. It only reads files up to a certain amount of bytes then crashes in the same manner explained above. Again this only happens when the program runs as a daemon. Run as a daemon how?
Re: Mac OS crash, details inside...
Run as a daemon how? By running the above code. All the code before opening the file causes the program to run as a daemon.
Re: Mac OS crash, details inside...
On 2013-06-13 19:42, Gary Willoughby wrote: I get a program crash each time running the following code on MacOS 10.8 (Lion). It seems to run ok on Ubuntu 12.04: import core.sys.posix.sys.stat; import core.sys.posix.unistd; import std.c.stdio; import std.c.stdlib; import std.process; import std.stdio; import std.string; import std.file; int main(string[] args) { pid_t pid, sid; pid = fork(); if (pid 0) { exit(EXIT_FAILURE); } if (pid 0) { exit(EXIT_SUCCESS); } umask(0); sid = setsid(); if (sid 0) { exit(EXIT_FAILURE); } if ((core.sys.posix.unistd.chdir(/)) 0) { exit(EXIT_FAILURE); } close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); auto logFile = File(/home/gary/Desktop/test.log, a); logFile.writeln(Reading file); string command = format(logger -t %s %s, hello, This is a test); executeShell(command); logFile.writeln(Done); return 0; } You do know that you usually don't have a /home/ directory on Mac OS X? On Mac OS X it's called /Users/. BTW, running that on Mac OS X 10.6.3 does not cause a crash. Although it doesn't seem to print or write anything. -- /Jacob Carlborg
Re: Mac OS crash, details inside...
You do know that you usually don't have a /home/ directory on Mac OS X? On Mac OS X it's called /Users/. Yeah, that was me running the same code on Ubuntu. BTW, running that on Mac OS X 10.6.3 does not cause a crash. Although it doesn't seem to print or write anything. That's the problem i can't pin down. It writes the above log file to /var/log/system.log. other than that there is no feedback at all, the program just ends without writing to the open file. It seems to be related to the daemon code as it doesn't happen when that code is commented out.
Re: Mac OS crash, details inside...
In fact i have the same problem reading files too. It only reads files up to a certain amount of bytes then crashes in the same manner explained above. Again this only happens when the program runs as a daemon.