From 109cef6c5213505d543505c0efff2df7a819b01d Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 21 Oct 2023 11:37:59 +0200 Subject: [PATCH] detect if program started in background and detach from console --- src/main.c | 6 ++++++ xschem_library/rom8k/rom8k.sch | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 70643669..1db8056e 100644 --- a/src/main.c +++ b/src/main.c @@ -95,6 +95,12 @@ int main(int argc, char **argv) } #endif argc = process_options(argc, argv); + + /* if invoked in background detach from console */ + if(getpgrp() != tcgetpgrp(STDOUT_FILENO)) { + cli_opt_detach = 1; + } + my_strdup(_ALLOC_ID_, &xschem_executable, argv[0]); if(debug_var>=1 && !has_x) fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n"); diff --git a/xschem_library/rom8k/rom8k.sch b/xschem_library/rom8k/rom8k.sch index c492206e..fddb5c39 100644 --- a/xschem_library/rom8k/rom8k.sch +++ b/xschem_library/rom8k/rom8k.sch @@ -366,7 +366,7 @@ descr="Graph Manual page" url="https://xschem.sourceforge.io/stefan/xschem_man/graphs.html"} C {simulator_commands.sym} 470 -150 0 0 {name=INTERACTIVE simulator=ngspice -spice_ignore=0 +spice_ignore=1 only_toplevel=false value=" .options SCALE=0.10 @@ -484,7 +484,7 @@ tclcommand=" } C {simulator_commands.sym} 340 -150 0 0 {name=BATCH_MODE simulator=ngspice -spice_ignore=1 +spice_ignore=0 only_toplevel=false value=" .options SCALE=0.10 @@ -513,7 +513,6 @@ vvss vss 0 0 C {launcher.sym} 300 -240 0 0 {name=h7 descr="Swap interactive / batch mode" tclcommand="proc simswap \{\} \{ - set x [xschem getprop instance INTERACTIVE spice_ignore] xschem setprop instance BATCH_MODE spice_ignore $x set x [expr \{ !$x\}]