Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
c76af325
Commit
c76af325
authored
Oct 25, 2014
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
unix/windows: Disable sigaction on windows port.
parent
b0b0012f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
unix/main.c
+12
-1
12 additions, 1 deletion
unix/main.c
with
12 additions
and
1 deletion
unix/main.c
+
12
−
1
View file @
c76af325
...
...
@@ -34,7 +34,6 @@
#include
<sys/stat.h>
#include
<sys/types.h>
#include
<errno.h>
#include
<signal.h>
#include
"mpconfig.h"
#include
"nlr.h"
...
...
@@ -65,6 +64,9 @@ mp_uint_t mp_verbose_flag = 0;
long
heap_size
=
128
*
1024
*
(
sizeof
(
mp_uint_t
)
/
4
);
#endif
#ifndef _WIN32
#include
<signal.h>
STATIC
mp_obj_t
keyboard_interrupt_obj
;
STATIC
void
sighandler
(
int
signum
)
{
...
...
@@ -78,6 +80,7 @@ STATIC void sighandler(int signum) {
sigaction
(
SIGINT
,
&
sa
,
NULL
);
}
}
#endif
#define FORCED_EXIT (0x100)
// returns standard error codes: 0 for success, 1 for all other errors
...
...
@@ -134,23 +137,29 @@ STATIC int execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind,
return
0
;
}
#ifndef _WIN32
// enable signal handler
struct
sigaction
sa
;
sa
.
sa_handler
=
sighandler
;
sigemptyset
(
&
sa
.
sa_mask
);
sigaction
(
SIGINT
,
&
sa
,
NULL
);
sa
.
sa_handler
=
SIG_DFL
;
#endif
// execute it
nlr_buf_t
nlr
;
if
(
nlr_push
(
&
nlr
)
==
0
)
{
mp_call_function_0
(
module_fun
);
#ifndef _WIN32
sigaction
(
SIGINT
,
&
sa
,
NULL
);
#endif
nlr_pop
();
return
0
;
}
else
{
// uncaught exception
#ifndef _WIN32
sigaction
(
SIGINT
,
&
sa
,
NULL
);
#endif
// check for SystemExit
mp_obj_t
exc
=
(
mp_obj_t
)
nlr
.
ret_val
;
if
(
mp_obj_is_subclass_fast
(
mp_obj_get_type
(
exc
),
&
mp_type_SystemExit
))
{
...
...
@@ -329,8 +338,10 @@ int main(int argc, char **argv) {
mp_init
();
#ifndef _WIN32
// create keyboard interrupt object
keyboard_interrupt_obj
=
mp_obj_new_exception
(
&
mp_type_KeyboardInterrupt
);
#endif
char
*
home
=
getenv
(
"HOME"
);
char
*
path
=
getenv
(
"MICROPYPATH"
);
...
...
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