This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gowebrpc. commit ebfc6585f797d672fec95bf2eee2f7af8bd352cd Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Mon Jun 21 18:26:10 2021 -0500 Improve JSON parsing. --- x2gorpc.cgi | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/x2gorpc.cgi b/x2gorpc.cgi index 07e5456..b86e4ac 100755 --- a/x2gorpc.cgi +++ b/x2gorpc.cgi @@ -101,7 +101,7 @@ sub suspendTerminateSession }; $robj->{'err'}=@out[1]; my $jsontext =JSON->new->utf8->encode ($robj); - print $jsontext; + print "__STARTJSON__".$jsontext; } sub startSession @@ -214,7 +214,7 @@ sub startSession finish: my $jsontext =JSON->new->utf8->encode ($robj); - print $jsontext; + print "__STARTJSON__".$jsontext; } @@ -247,6 +247,20 @@ sub openChannel } } + +sub simplifyOutput +{ + my $stout=shift; + $stout=~s/\[//g; + $stout=~s/\]//g; + $stout=~s/\{//g; + $stout=~s/\}//g; + $stout=~s/\"//g; + $stout=~s/\'//g; + return $stout; +} + + sub runSSHCommand { my $command=shift; @@ -326,7 +340,7 @@ sub runSSHCommand return (1,"Can't connect to Server", $exp->exp_before().$exp->exp_match()); } - return $exp->exp_before().$exp->exp_match(); + return simplifyOutput($exp->exp_before().$exp->exp_match()); } sub connectToProxy @@ -356,8 +370,8 @@ sub parseOutput my $err=$listout[0]; my $stout=$listout[1]; $stout=(split("STDOUT_END",$stout))[0]; - $robj->{'stdout'}=$stout; - $robj->{'stderr'}=$err; + $robj->{'stdout'}=simplifyOutput($stout); + $robj->{'stderr'}=simplifyOutput($err); } sub getFreePort -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gowebrpc.git