Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Willers
KWSys
Commits
05249b04
Commit
05249b04
authored
21 years ago
by
Andy Cedilnik
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Start working on Working Directory support
parent
b34f3b60
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Process.h.in
+8
-0
8 additions, 0 deletions
Process.h.in
ProcessUNIX.c
+26
-0
26 additions, 0 deletions
ProcessUNIX.c
with
34 additions
and
0 deletions
Process.h.in
+
8
−
0
View file @
05249b04
...
...
@@ -31,6 +31,7 @@
#define kwsysProcess_Delete kwsys(Process_Delete)
#define kwsysProcess_SetCommand kwsys(Process_SetCommand)
#define kwsysProcess_SetTimeout kwsys(Process_SetTimeout)
#define kwsysProcess_SetWorkingDirectory kwsys(Process_SetWorkingDirectory)
#define kwsysProcess_State_Starting kwsys(Process_State_Starting)
#define kwsysProcess_State_Error kwsys(Process_State_Error)
#define kwsysProcess_State_Exception kwsys(Process_State_Exception)
...
...
@@ -97,6 +98,12 @@ kwsysEXPORT void kwsysProcess_SetCommand(kwsysProcess* cp,
*/
kwsysEXPORT void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout);
/**
* Set the working directory for the child process. The working directory can
* be absolute or relative to the current directory.
*/
kwsysEXPORT void kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir);
/**
* Get the current state of the Process instance. Possible states are:
*
...
...
@@ -254,6 +261,7 @@ kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp);
# undef kwsysProcess_Delete
# undef kwsysProcess_SetCommand
# undef kwsysProcess_SetTimeout
# undef kwsysProcess_SetWorkingDirectory
# undef kwsysProcess_State_Starting
# undef kwsysProcess_State_Error
# undef kwsysProcess_State_Exception
...
...
This diff is collapsed.
Click to expand it.
ProcessUNIX.c
+
26
−
0
View file @
05249b04
...
...
@@ -99,6 +99,9 @@ struct kwsysProcess_s
/* The timeout length. */
double
Timeout
;
/* The working directory for the process. */
char
*
WorkingDirectory
;
/* Time at which the child started. Negative for no timeout. */
kwsysProcessTime
StartTime
;
...
...
@@ -206,6 +209,29 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
}
}
/*--------------------------------------------------------------------------*/
void
kwsysProcess_SetWorkingDirectory
(
kwsysProcess
*
cp
,
const
char
*
dir
)
{
if
(
cp
->
WorkingDirectory
==
dir
)
{
return
;
}
if
(
cp
->
WorkingDirectory
&&
dir
&&
strcmp
(
cp
->
WorkingDirectory
,
dir
)
==
0
)
{
return
;
}
if
(
cp
->
WorkingDirectory
)
{
free
(
cp
->
WorkingDirectory
);
cp
->
WorkingDirectory
=
0
;
}
if
(
dir
)
{
cp
->
WorkingDirectory
=
(
char
*
)
malloc
(
strlen
(
dir
)
+
1
);
strcpy
(
cp
->
WorkingDirectory
,
dir
);
}
}
/*--------------------------------------------------------------------------*/
int
kwsysProcess_GetState
(
kwsysProcess
*
cp
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment