mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Preserve cwd after spawn
This commit is contained in:
parent
401ab0c98e
commit
8d2b222c1a
1 changed files with 13 additions and 0 deletions
|
@ -844,6 +844,8 @@ BFP_EXPORT BfpSpawn* BFP_CALLTYPE BfpSpawn_Create(const char* inTargetPath, cons
|
||||||
|
|
||||||
//printf("BfpSpawn_Create: %s %s %x\n", inTargetPath, args, flags);
|
//printf("BfpSpawn_Create: %s %s %x\n", inTargetPath, args, flags);
|
||||||
|
|
||||||
|
char* prevWorkingDir = NULL;
|
||||||
|
|
||||||
if ((workingDir != NULL) && (workingDir[0] != 0))
|
if ((workingDir != NULL) && (workingDir[0] != 0))
|
||||||
{
|
{
|
||||||
if (chdir(workingDir) != 0)
|
if (chdir(workingDir) != 0)
|
||||||
|
@ -852,8 +854,19 @@ BFP_EXPORT BfpSpawn* BFP_CALLTYPE BfpSpawn_Create(const char* inTargetPath, cons
|
||||||
OUTRESULT(BfpSpawnResult_UnknownError);
|
OUTRESULT(BfpSpawnResult_UnknownError);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prevWorkingDir = getcwd(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer(
|
||||||
|
{
|
||||||
|
if (prevWorkingDir != NULL)
|
||||||
|
{
|
||||||
|
chdir(prevWorkingDir);
|
||||||
|
free(prevWorkingDir);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
String newArgs;
|
String newArgs;
|
||||||
String tempFileName;
|
String tempFileName;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue