Re: [Lazarus] TProcess not mirroring terminal
On 06/02/2015 04:08 PM, JuuS wrote: On 06/02/2015 03:42 PM, Marc Santhoff wrote: On Di, 2015-06-02 at 14:21 +0200, JuuS wrote: Anyone have an idea why this is so??? Maybe the difference is that your TProcess is reading only stdout, not stderr. Dunno if there is a switch in TProcess, if not you'd need to redirect stderr to stdout (which is shell dependant, 21 for sh, for csh, IIRC). Thanks for reply Marc, but Michael had it absolutely right. I changed my TProcess to run /bin/sh instead of rsync, added -c as first param, then the entire rsync command as second param. It works Great! Ooops. Just sent this note so that no one becomes misled. It does NOT work if there are spaces in the paths (for example a source folder with name '/myfolder/File name'). Sent it with 's surrounding it and rsync still does not understand it, even though it is coming through /bin/sh. No worries, I'll work something out. Just didn't want this thread to lead people down the wrong path... Thanks for your answers guys. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
On 06/04/2015 01:05 PM, JuuS wrote: On 06/02/2015 04:08 PM, JuuS wrote: On 06/02/2015 03:42 PM, Marc Santhoff wrote: On Di, 2015-06-02 at 14:21 +0200, JuuS wrote: Anyone have an idea why this is so??? Maybe the difference is that your TProcess is reading only stdout, not stderr. Dunno if there is a switch in TProcess, if not you'd need to redirect stderr to stdout (which is shell dependant, 21 for sh, for csh, IIRC). Thanks for reply Marc, but Michael had it absolutely right. I changed my TProcess to run /bin/sh instead of rsync, added -c as first param, then the entire rsync command as second param. It works Great! Ooops. Just sent this note so that no one becomes misled. It does NOT work if there are spaces in the paths (for example a source folder with name '/myfolder/File name'). Sent it with 's surrounding it and rsync still does not understand it, even though it is coming through /bin/sh. No worries, I'll work something out. Just didn't want this thread to lead people down the wrong path... Sorry for the bother...solution is to replace all spaces ( ) with backslash escape (\ ). I go back in my hole now. Thanks for your answers guys. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TProcess not mirroring terminal
Hi All, I'm using Lazarus 1.4 with Kubuntu 14.04 I've written a small GUI frontend for the rsync command. I assemble rsync command line switches and source and destination thru the TProcess paramlist and everything has been exactly mirrored by my program and when the exact same command is run through a terminal, it has worked perfectly for everything I want to do with rsync... ...until today. For the first time my output and the output from the same command line run in terminal work differently. Run it through terminal and the command is accepted, however running it through TProcess and rsync complains! The two outputs are listed below, the parameters passed are exactly the same. Anyone have an idea why this is so??? TERMINAL OUTPUT: juus@JuuSKub:~$ rsync -n -vshtplgiE --stats --modify-window=1 --progress /home/juus/Documents/** /media/juus/Lin1TB/BKactive skipping directory CodeBlocks skipping directory IntelliJ skipping directory qt f+ hackjs5.html f+ hackjs7.html f+ hackjs8.html Number of files: 3 (reg: 3) Number of created files: 3 (reg: 3) Number of deleted files: 0 Number of regular files transferred: 3 OUTPUT FROM MY PROGRAM rsync: link_stat /home/juus/Documents/** failed: No such file or directory (2) Number of files: 0 Number of created files: 0 Number of deleted files: 0 Number of regular files transferred: 0 :: Parameters passed to RSYNC: -n -vshtplgiE --stats --modify-window=1 --progress /home/juus/Documents/** /media/juus/Lin1TB/BKactive thanks, Julius -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
On 06/02/2015 03:42 PM, Marc Santhoff wrote: On Di, 2015-06-02 at 14:21 +0200, JuuS wrote: Anyone have an idea why this is so??? Maybe the difference is that your TProcess is reading only stdout, not stderr. Dunno if there is a switch in TProcess, if not you'd need to redirect stderr to stdout (which is shell dependant, 21 for sh, for csh, IIRC). Thanks for reply Marc, but Michael had it absolutely right. I changed my TProcess to run /bin/sh instead of rsync, added -c as first param, then the entire rsync command as second param. It works Great! Thanks for your answers guys. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
On 06/02/2015 04:20 PM, Mark Morgan Lloyd wrote: JuuS wrote: Thanks for the answer. wildcards do work fine when I make exclude and include params, but then those are interpreted by rsync as simple patterns to match. So you are saying that in the case of the actual source folder param the shell must be involved and passing it through TProcess params won't work? Note also this behaviour from Bash: Interesting insight, thanks. I've learned a lot about shell today... :) $ echo fpc* fpc fpc.tar fpcbuild-2.2.4.tar.gz fpcbuild-2.4.0.tar.gz $ echo fred* fred* So * is expanded if files match, but is passed through unchanged if not. This means that if your program isn't expanding * based on what's in a directory, there are some cases where it will be behaving the same as the shell :-) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
JuuS wrote: Thanks for the answer. wildcards do work fine when I make exclude and include params, but then those are interpreted by rsync as simple patterns to match. So you are saying that in the case of the actual source folder param the shell must be involved and passing it through TProcess params won't work? Note also this behaviour from Bash: $ echo fpc* fpc fpc.tar fpcbuild-2.2.4.tar.gz fpcbuild-2.4.0.tar.gz $ echo fred* fred* So * is expanded if files match, but is passed through unchanged if not. This means that if your program isn't expanding * based on what's in a directory, there are some cases where it will be behaving the same as the shell :-) -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
On Tue, 2 Jun 2015, JuuS wrote: Hi All, I'm using Lazarus 1.4 with Kubuntu 14.04 I've written a small GUI frontend for the rsync command. I assemble rsync command line switches and source and destination thru the TProcess paramlist and everything has been exactly mirrored by my program and when the exact same command is run through a terminal, it has worked perfectly for everything I want to do with rsync... ...until today. For the first time my output and the output from the same command line run in terminal work differently. Run it through terminal and the command is accepted, however running it through TProcess and rsync complains! The two outputs are listed below, the parameters passed are exactly the same. Anyone have an idea why this is so??? As a wild guess: You cannot specify * or ** (or any wildcard), because that must be escaped using the shell. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
On Di, 2015-06-02 at 14:21 +0200, JuuS wrote: Anyone have an idea why this is so??? TERMINAL OUTPUT: juus@JuuSKub:~$ rsync -n -vshtplgiE --stats --modify-window=1 --progress /home/juus/Documents/** /media/juus/Lin1TB/BKactive skipping directory CodeBlocks skipping directory IntelliJ skipping directory qt f+ hackjs5.html f+ hackjs7.html f+ hackjs8.html Number of files: 3 (reg: 3) Number of created files: 3 (reg: 3) Number of deleted files: 0 Number of regular files transferred: 3 OUTPUT FROM MY PROGRAM rsync: link_stat /home/juus/Documents/** failed: No such file or directory (2) Number of files: 0 Number of created files: 0 Number of deleted files: 0 Number of regular files transferred: 0 Maybe the difference is that your TProcess is reading only stdout, not stderr. Dunno if there is a switch in TProcess, if not you'd need to redirect stderr to stdout (which is shell dependant, 21 for sh, for csh, IIRC). -- Marc Santhoff m.santh...@web.de -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
You can simply execute the shell and use its -c option to pass the rsync command with all options. Ok, thanks Michael. I will look into it. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
On Tue, 2 Jun 2015, JuuS wrote: On 06/02/2015 02:31 PM, Michael Van Canneyt wrote: On Tue, 2 Jun 2015, JuuS wrote: Hi All, I'm using Lazarus 1.4 with Kubuntu 14.04 I've written a small GUI frontend for the rsync command. I assemble rsync command line switches and source and destination thru the TProcess paramlist and everything has been exactly mirrored by my program and when the exact same command is run through a terminal, it has worked perfectly for everything I want to do with rsync... ...until today. For the first time my output and the output from the same command line run in terminal work differently. Run it through terminal and the command is accepted, however running it through TProcess and rsync complains! The two outputs are listed below, the parameters passed are exactly the same. Anyone have an idea why this is so??? As a wild guess: You cannot specify * or ** (or any wildcard), because that must be escaped using the shell. Thanks for the answer. wildcards do work fine when I make exclude and include params, but then those are interpreted by rsync as simple patterns to match. So you are saying that in the case of the actual source folder param the shell must be involved and passing it through TProcess params won't work? If you type the command on the command-line, then the shell will have interpreted them. rsync will not see them. I can live with this, but it would be nice for it work. Any way to tickle the shell in some way through TProcess?? You can simply execute the shell and use its -c option to pass the rsync command with all options. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess not mirroring terminal
On 06/02/2015 02:31 PM, Michael Van Canneyt wrote: On Tue, 2 Jun 2015, JuuS wrote: Hi All, I'm using Lazarus 1.4 with Kubuntu 14.04 I've written a small GUI frontend for the rsync command. I assemble rsync command line switches and source and destination thru the TProcess paramlist and everything has been exactly mirrored by my program and when the exact same command is run through a terminal, it has worked perfectly for everything I want to do with rsync... ...until today. For the first time my output and the output from the same command line run in terminal work differently. Run it through terminal and the command is accepted, however running it through TProcess and rsync complains! The two outputs are listed below, the parameters passed are exactly the same. Anyone have an idea why this is so??? As a wild guess: You cannot specify * or ** (or any wildcard), because that must be escaped using the shell. Thanks for the answer. wildcards do work fine when I make exclude and include params, but then those are interpreted by rsync as simple patterns to match. So you are saying that in the case of the actual source folder param the shell must be involved and passing it through TProcess params won't work? I can live with this, but it would be nice for it work. Any way to tickle the shell in some way through TProcess?? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus