... seems to e pretty difficult ...
I tried stuff like: GsHostProcess>>mskCopyFile: source to: target | aGsHostProcess output aWriteStream | aWriteStream := WriteStream on: String new. aWriteStream nextPutAll: '/bin/bash -c ' ; nextPut: $' ; nextPutAll: 'cp ' ; nextPut: $" ; nextPutAll: source asString ; nextPut: $" ; space ; nextPut: $" ; nextPutAll: target asString ; nextPut: $" ; nextPut: $' . Transcript cr ; show: aWriteStream contents. aGsHostProcess := GsHostProcess fork: aWriteStream contents. .... When executing stuff like GsHostProcess mskCopyFile: '/var/www/fileswebcati/customers/test.txt' to: '/var/www/fileswebcati/customers/test2.txt' the following command is printed on the Transcript: /bin/bash -c 'cp "/var/www/fileswebcati/customers/test.txt" "/var/www/fileswebcati/customers/test2.txt"' executing it in a real shell: everything is ok. So: anyone telling me, how a simple "cp" can be executed under Gemstone ... Marten -- Marten Feldtmann _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Can't you use: System performOnServer: 'cp /hola.txt /bye.txt' ? On Thu, Jun 11, 2015 at 4:12 PM, [hidden email] via Glass <[hidden email]> wrote: ... seems to e pretty difficult ... _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Yes, that could be done ... but why does the other stuff not work or
better: how is it used ? Marten Am 11.06.2015 um 21:21 schrieb Mariano Martinez Peck: > Can't you use: > > System performOnServer: 'cp /hola.txt /bye.txt' > > ? > > On Thu, Jun 11, 2015 at 4:12 PM, [hidden email] > <mailto:[hidden email]> via Glass > <[hidden email] <mailto:[hidden email]>> > wrote: > > ... seems to e pretty difficult ... > > I tried stuff like: > > GsHostProcess>>mskCopyFile: source to: target > | aGsHostProcess output aWriteStream | > > aWriteStream := WriteStream on: String new. > aWriteStream > nextPutAll: '/bin/bash -c ' ; > nextPut: $' ; > nextPutAll: 'cp ' ; > nextPut: $" ; > nextPutAll: source asString ; > nextPut: $" ; > space ; > nextPut: $" ; > nextPutAll: target asString ; > nextPut: $" ; > nextPut: $' . > > Transcript cr ; show: aWriteStream contents. > > aGsHostProcess := GsHostProcess fork: aWriteStream contents. > .... > > When executing stuff like > > GsHostProcess > mskCopyFile: '/var/www/fileswebcati/customers/test.txt' > to: '/var/www/fileswebcati/customers/test2.txt' > > the following command is printed on the Transcript: > > /bin/bash -c 'cp "/var/www/fileswebcati/customers/test.txt" > "/var/www/fileswebcati/customers/test2.txt"' > > executing it in a real shell: everything is ok. > > So: anyone telling me, how a simple "cp" can be executed under > Gemstone ... > > > Marten > > > -- > Marten Feldtmann > _______________________________________________ > Glass mailing list > [hidden email] <mailto:[hidden email]> > http://lists.gemtalksystems.com/mailman/listinfo/glass > > > > > -- > Mariano > http://marianopeck.wordpress.com -- Marten Feldtmann _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
In reply to this post by GLASS mailing list
Marten,
At first blush, I agree that this should work ... checking with others in engineering to get the real skinny on GsHostProcess ... Dale On 06/11/2015 12:12 PM, [hidden email] via Glass wrote: > ... seems to e pretty difficult ... > > I tried stuff like: > > GsHostProcess>>mskCopyFile: source to: target > | aGsHostProcess output aWriteStream | > > aWriteStream := WriteStream on: String new. > aWriteStream > nextPutAll: '/bin/bash -c ' ; > nextPut: $' ; > nextPutAll: 'cp ' ; > nextPut: $" ; > nextPutAll: source asString ; > nextPut: $" ; > space ; > nextPut: $" ; > nextPutAll: target asString ; > nextPut: $" ; > nextPut: $' . > > Transcript cr ; show: aWriteStream contents. > > aGsHostProcess := GsHostProcess fork: aWriteStream contents. > .... > > When executing stuff like > > GsHostProcess > mskCopyFile: '/var/www/fileswebcati/customers/test.txt' > to: '/var/www/fileswebcati/customers/test2.txt' > > the following command is printed on the Transcript: > > /bin/bash -c 'cp "/var/www/fileswebcati/customers/test.txt" > "/var/www/fileswebcati/customers/test2.txt"' > > executing it in a real shell: everything is ok. > > So: anyone telling me, how a simple "cp" can be executed under Gemstone ... > > > Marten > > _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
In reply to this post by GLASS mailing list
Hi Marten,
It turns out that GsHostProcess does not handle single quoted strings quite right. We have reported this internally as bug #45386. The work-around is to reverse your use of single and double quotes: | aGsHostProcess output aWriteStream source target command | source := '/foo/bar.1'. target := '/foo/bar.2'. aWriteStream := WriteStream on: String new. aWriteStream nextPutAll: '/bin/bash -c "cp ''' ; nextPutAll: source asString ; nextPutAll: ''' '''; nextPutAll: target asString ; nextPutAll: '''"' . command := aWriteStream contents. aGsHostProcess := GsHostProcess fork: command. aWriteStream := WriteStream on: String new. (Delay forSeconds: 1) wait. aWriteStream nextPutAll: 'original command is '; lf; tab; nextPutAll: command; lf; nextPutAll: 'childHasExited is '; nextPutAll: aGsHostProcess childHasExited printString; lf; nextPutAll: 'childStatus is '; nextPutAll: aGsHostProcess childStatus printString; lf; nextPutAll: 'commandLine is '; lf; tab; nextPutAll: aGsHostProcess commandLine; lf; nextPutAll: 'processId is '; nextPutAll: aGsHostProcess processId printString; lf; nextPutAll: 'stderr is '; lf; tab; nextPutAll: (aGsHostProcess stderr readWillNotBlock ifTrue: [aGsHostProcess stderr readString: 1024] ifFalse: ['']); lf; nextPutAll: 'stdout is '; lf; tab; nextPutAll: (aGsHostProcess stdout readWillNotBlock ifTrue: [aGsHostProcess stdout readString: 1024] ifFalse: ['']); lf; yourself. aWriteStream contents. original command is /bin/bash -c "cp '/foo/bar.1' '/foo/bar.2'" childHasExited is true childStatus is 127 commandLine is /bin/bash -c "cp '/foo/bar.1' '/foo/bar.2'" processId is nil stderr is /bin/bash: cp '/foo/bar.1' '/foo/bar.2': No such file or directory stdout is See if this works for you. James > On Jun 11, 2015, at 12:12 PM, [hidden email] via Glass <[hidden email]> wrote: > > ... seems to e pretty difficult ... > > I tried stuff like: > > GsHostProcess>>mskCopyFile: source to: target > | aGsHostProcess output aWriteStream | > > aWriteStream := WriteStream on: String new. > aWriteStream > nextPutAll: '/bin/bash -c ' ; > nextPut: $' ; > nextPutAll: 'cp ' ; > nextPut: $" ; > nextPutAll: source asString ; > nextPut: $" ; > space ; > nextPut: $" ; > nextPutAll: target asString ; > nextPut: $" ; > nextPut: $' . > > Transcript cr ; show: aWriteStream contents. > > aGsHostProcess := GsHostProcess fork: aWriteStream contents. > .... > > When executing stuff like > > GsHostProcess > mskCopyFile: '/var/www/fileswebcati/customers/test.txt' > to: '/var/www/fileswebcati/customers/test2.txt' > > the following command is printed on the Transcript: > > /bin/bash -c 'cp "/var/www/fileswebcati/customers/test.txt" > "/var/www/fileswebcati/customers/test2.txt"' > > executing it in a real shell: everything is ok. > > So: anyone telling me, how a simple "cp" can be executed under Gemstone ... > > > Marten > > > -- > Marten Feldtmann > _______________________________________________ > Glass mailing list > [hidden email] > http://lists.gemtalksystems.com/mailman/listinfo/glass _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Free forum by Nabble | Edit this page |