From a128df47e0ebb2a4d14d46e4b07d2abbf79f421e Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 7 Nov 2023 23:39:18 +0100 Subject: [PATCH] proc simuldir: set directory to [xschem current_dirname]/simulation but do not create it until doing the netlist --- src/main.c | 19 ++++++++++++------- src/xschem.tcl | 13 +++++++------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main.c b/src/main.c index 606878a4..914107da 100644 --- a/src/main.c +++ b/src/main.c @@ -26,11 +26,13 @@ #endif #include +/* can not install a child handler as the tcl-tk toolkit probably already uses it */ +/* #define HANDLE_SIGCHLD */ + static void sig_handler(int s){ char emergency_prefix[PATH_MAX]; const char *emergency_dir; - if(s==SIGINT) { fprintf(errfp, "Use 'exit' to close the program\n"); return; @@ -58,13 +60,13 @@ static void sig_handler(int s){ exit(EXIT_FAILURE); } -#if 0 +#ifdef HANDLE_SIGCHLD static void child_handler(int signum) { - /* fprintf(errfp, "SIGCHLD received\n"); */ -#ifdef __unix__ - wait(NULL); -#endif + fprintf(errfp, "SIGCHLD received\n"); + #ifdef __unix__ + wait(NULL); + #endif } #endif @@ -81,7 +83,10 @@ int main(int argc, char **argv) signal(SIGILL, sig_handler); signal(SIGTERM, sig_handler); signal(SIGFPE, sig_handler); - /* signal(SIGCHLD, child_handler); */ /* avoid zombies 20180925 --> conflicts with tcl exec */ + + #ifdef HANDLE_SIGCHLD + signal(SIGCHLD, child_handler); /* avoid zombies 20180925 --> conflicts with tcl exec */ + #endif errfp=stderr; /* 20181013 check for empty or non existing DISPLAY *before* calling Tk_Main or Tcl_Main */ diff --git a/src/xschem.tcl b/src/xschem.tcl index 82bb10eb..958a5235 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3774,12 +3774,13 @@ proc simuldir {} { global netlist_dir local_netlist_dir has_x if { $local_netlist_dir == 1 } { set simdir [xschem get current_dirname]/simulation - if {[catch {file mkdir "$simdir"} err]} { - puts $err - if {[info exists has_x]} { - tk_messageBox -message "$err" -icon error -parent [xschem get topwindow] -type ok - } - } + + # if {[catch {file mkdir "$simdir"} err]} { + # puts $err + # if {[info exists has_x]} { + # tk_messageBox -message "$err" -icon error -parent [xschem get topwindow] -type ok + # } + # } set netlist_dir $simdir return $netlist_dir }