Problem with system()
Problem with system()
- Subject: Problem with system()
- From: Norm Green <email@hidden>
- Date: Fri, 6 Jul 2007 11:07:45 -0700
Title: Problem with system()
I cannot get the system command to work from within my program and I see a strange error message printed to stdout/stderr when I try.
If I run:
int rc = system("date >/usr/tmp/tmp.kPCvVa");
If fails with rc == 256 and errno == 0 and prints this to stderr:
sh: line 1: 1: Bad file descriptor
I know the path is OK because the file /usr/tmp/tmp.kPCvVa *IS* created, but it has a size of zero.
I've also checked to make sure
system(NULL) == 0;
as it should.
To make it even more weird: if I start the process under gdb and run the code, it works perfectly!
Any idea what's going on? Can there be some reason the shell process (sh) created by the system() call cannot write to stdout?
Norm Green
GemStone Systems Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden