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
Container Registry
Model registry
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
Rolf Eike Beer
KWSys
Commits
39b3e998
Commit
39b3e998
authored
21 years ago
by
Brad King
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Made error message consistent between win9x and non-win9x version of error reporting.
parent
011a8c42
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ProcessWin32.c
+35
-25
35 additions, 25 deletions
ProcessWin32.c
with
35 additions
and
25 deletions
ProcessWin32.c
+
35
−
25
View file @
39b3e998
...
...
@@ -70,6 +70,7 @@ static DWORD WINAPI kwsysProcessPipeThread(LPVOID ptd);
static
void
kwsysProcessPipeThreadReadPipe
(
kwsysProcess
*
cp
,
kwsysProcessPipeData
*
td
);
static
void
kwsysProcessCleanupHandle
(
PHANDLE
h
);
static
void
kwsysProcessCleanup
(
kwsysProcess
*
cp
,
int
error
);
static
void
kwsysProcessCleanErrorMessage
(
kwsysProcess
*
cp
);
static
int
kwsysProcessGetTimeoutTime
(
kwsysProcess
*
cp
,
double
*
userTimeout
,
kwsysProcessTime
*
timeoutTime
);
static
int
kwsysProcessGetTimeoutLeft
(
kwsysProcessTime
*
timeoutTime
,
...
...
@@ -1050,8 +1051,12 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
}
else
if
(
cp
->
ErrorMessageLength
)
{
/* Failed to run the process. */
/* The Win9x forwarding executing repored data on the special
error pipe. Failed to run the process. */
cp
->
State
=
kwsysProcess_State_Error
;
/* Remove trailing period and newline from message, if any. */
kwsysProcessCleanErrorMessage
(
cp
);
}
else
if
(
cp
->
TimeoutExpired
)
{
...
...
@@ -1111,7 +1116,7 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
else
{
/* Error getting the child return code. */
strcpy
(
cp
->
ErrorMessage
,
"Error getting child return code
.
"
);
strcpy
(
cp
->
ErrorMessage
,
"Error getting child return code"
);
cp
->
State
=
kwsysProcess_State_Error
;
}
...
...
@@ -1261,37 +1266,20 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error)
FORMAT_MESSAGE_IGNORE_INSERTS
,
0
,
original
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
cp
->
ErrorMessage
,
CMPE_PIPE_BUFFER_SIZE
,
0
);
if
(
length
>
0
)
{
/* Remove trailing period and newline, if any. */
if
(
cp
->
ErrorMessage
[
length
-
1
]
==
'\n'
)
{
cp
->
ErrorMessage
[
length
-
1
]
=
0
;
--
length
;
if
(
length
>
0
&&
cp
->
ErrorMessage
[
length
-
1
]
==
'\r'
)
{
cp
->
ErrorMessage
[
length
-
1
]
=
0
;
--
length
;
}
}
if
(
cp
->
ErrorMessage
[
length
-
1
]
==
'.'
)
{
cp
->
ErrorMessage
[
length
-
1
]
=
0
;
--
length
;
}
}
else
if
(
length
<
1
)
{
/* FormatMessage failed. Use a default message. */
_snprintf
(
cp
->
ErrorMessage
,
CMPE_PIPE_BUFFER_SIZE
,
"Process execution failed with error 0x%X. "
"FormatMessage failed with error 0x%X
.
"
,
"FormatMessage failed with error 0x%X"
,
original
,
GetLastError
());
}
/* Set the error state. */
cp
->
State
=
kwsysProcess_State_Error
;
/* Remove trailing period and newline, if any. */
kwsysProcessCleanErrorMessage
(
cp
);
}
/* Free memory. */
...
...
@@ -1309,6 +1297,28 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error)
}
}
/*--------------------------------------------------------------------------*/
void
kwsysProcessCleanErrorMessage
(
kwsysProcess
*
cp
)
{
/* Remove trailing period and newline, if any. */
int
length
=
strlen
(
cp
->
ErrorMessage
);
if
(
cp
->
ErrorMessage
[
length
-
1
]
==
'\n'
)
{
cp
->
ErrorMessage
[
length
-
1
]
=
0
;
--
length
;
if
(
length
>
0
&&
cp
->
ErrorMessage
[
length
-
1
]
==
'\r'
)
{
cp
->
ErrorMessage
[
length
-
1
]
=
0
;
--
length
;
}
}
if
(
length
>
0
&&
cp
->
ErrorMessage
[
length
-
1
]
==
'.'
)
{
cp
->
ErrorMessage
[
length
-
1
]
=
0
;
--
length
;
}
}
/*--------------------------------------------------------------------------*/
/* Get the time at which either the process or user timeout will
expire. Returns 1 if the user timeout is first, and 0 otherwise. */
...
...
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