One app depends on terminal to work
Posted
#1
(In Topic #1454)
Regular

I have made an app that uses Shell to run scripts and return values. The launcher on DESKTOP only works if I mark "Run in terminal"
It seems it is depending on a terminal attached to work.
If I mark Run on terminal or open it from a terminal, it works correctly.
The Desktop laucher without "Run in terminal" does not work totally and I confirmed it is related with Shell commands in my code that returns empty in this situation
Some clues to solve it ?
Regards
Posted
Regular

Problem SOLVED !
I discover the problem was related with the command itself that was run on ShellsBasically one script could receive the "param" from command line OR from pipe (accepts both)
In terminal both work:
$ oneapp arg1
$ echo arg1 | oneapp
But in gambas I will have to use only PIPE to work always.
Code
Shell "echo " & myvar & " | oneapp " to avar 'Works, avar gets it
Shell "oneapp " & myvar to avar ' Fails without one terminal attached. avar gets empty
But via PIPE works always.
Regards,
Sergio
Posted
Guru

you can simply re-direct stderr to stdout using 2>&1
like this…
Some programs (like ffmpeg) need a terminal and require a proper input/output handler.
that can be handled like this..
Posted
Regular

Nice
Posted
Regular

Posted
Regular

The funny is that on the IDE it runs, as my original code too.
Pipe someways save from problems.
Hope this help others. Use pipe if possible
Posted
Regular

Mistery off
I finally found the problem.If you use ARGV to pass to python and this python program also checks STDIN (pipe), it generates the conflict with gambas.
If a python script checks the state of pipe (stdin) I can not pass values only via command line in gambas, because when python checks stdin the conflict occurs. The terminal solves the "STDIN hunger" of python allowing the ARGV free to work with gambas.
To use only command line args I would have to stop this PIPE checking in python. So I decided to send always with pipe allowing the python have both ways.
In other words:
If a program has PIPE support (stdin), you have to use this method when passing values from gambas, or it wil "ask for a terminal".
Now the desktop launcher works too, even without terminal.
Posted
Guru

1 guest and 0 members have just viewed this.


