StefanSchippers / xschem

A schematic editor for VLSI/Asic/Analog custom designs, netlist backends for VHDL, Spice and Verilog. The tool is focused on hierarchy and parametric designs, to maximize circuit reuse.
Other
300 stars 22 forks source link

xschem dosent work from my terminal if i type "xschem &\n" but "xschem\n" works #129

Closed olisnr closed 9 months ago

olisnr commented 9 months ago

if i use the xschem & from bash in a gnome-terminal, then the menus are blocked and the xschem window isnt refreshed if i change the window size. but xschem is woking itself

olisnr commented 9 months ago

v3.4.5

olisnr commented 9 months ago

end process dont work, only kill process to end the & started program

StefanSchippers commented 9 months ago

This is expected. Xschem uses the shell as a terminal for user interaction. If you want to launch xschem in the background you must detach it from stdin/stdout/stderr. Background processes can not communicate with the terminal and if they attempt to poll they will block.

Use the -b option:

xschem -b & should work fine.

olisnr commented 9 months ago

could i try to write noblocking to stdout and stderr, and look if there is an timout or error, and then decide if it has tho use the -b mode? or wouldent that work because of some other things?

StefanSchippers commented 9 months ago

Don't know exactly, but if you try to run the wish tk shell in background you have the same problem.

schippes@asus:~$ wish &
[1] 18276
schippes@asus:~$ 

[1]+  Stopped                 wish
StefanSchippers commented 9 months ago

even the bash shell should not be run in background: it can't read/write to the terminal so it blocks may be trying to write the prompt:

schippes@asus:~$ sh &
[3] 18770
schippes@asus:~$ 

[3]+  Stopped                 sh
StefanSchippers commented 9 months ago

command shells shoud not be run in the background, it is a non sense since their primary function is to interact via the terminal. Xschem is a GUI app so can work without CLI . This is the reason for the -b option. Turn off I/O from/to the terminal.

olisnr commented 9 months ago

the thing is, that i never saw a frozen window in a GUi-SW after starting it form commandline and &... even magic (a really strane SW dont freezes).

im certain there is a way to fix it, but its more difficult then i thought.

StefanSchippers commented 9 months ago

I think it is now fixed. At the very beginning (main.c) xschem checks its running process grpup ID (PGID) and if it is different from the controling terminal one then it self-detaches from the console (does not accept commands and does not print info there).

  /* if invoked in background detach from console */
  if(getpgrp() != tcgetpgrp(STDOUT_FILENO)) {
    cli_opt_detach = 1;
  }

Please test, if it works close the issue.

olisnr commented 9 months ago

it works. thanks