Changed system() to use load_image() instead of the old _kern_create_team() syscall.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9357 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-10-14 17:47:49 +00:00
parent e56c30d87d
commit beee70da41

View File

@ -3,15 +3,15 @@
** Distributed under the terms of the Haiku License.
*/
#include <errno.h>
#include <image.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <OS.h>
#include <syscalls.h>
extern "C"
int
extern "C" int
system(const char *command)
{
if (!command)
@ -20,15 +20,14 @@ system(const char *command)
const char *argv[] = { "/bin/sh", "-c", command, NULL };
int argc = 3;
team_id team = _kern_create_team(argv[0], argv[0], (char**)argv, argc, NULL,
0, B_NORMAL_PRIORITY);
if (team < 0) {
errno = team;
thread_id thread = load_image(argc, argv, (const char **)environ);
if (thread < 0) {
errno = thread;
return -1;
}
status_t returnValue;
status_t error = _kern_wait_for_team(team, &returnValue);
status_t error = wait_for_thread(thread, &returnValue);
if (error != B_OK) {
errno = error;
return -1;