detect if program started in background and detach from console

This commit is contained in:
stefan schippers 2023-10-21 11:37:59 +02:00
parent f2fd7e6e48
commit 109cef6c52
2 changed files with 8 additions and 3 deletions

View File

@ -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");

View File

@ -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\}]