Results 1 to 14 of 14

Thread: QProcess - Git

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Remember what d_stranz wrote : Assuming of course that the git program is on your system's executable search path and that you have permission to execute it.

  2. #2
    Join Date
    Dec 2015
    Posts
    35
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    The same problem for the 2nd method :
    Qt Code:
    1. QProcess process;
    2. QStringList arguments;
    3. arguments << "clone" << "ssh://user@host:port/Template.git";
    4. process.start( "git", arguments );
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. process.start("git clone ssh://user@host:port/Template.git");
    2.  
    3. if (!process.waitForStarted()) {
    4. qDebug() << "Error : " << process.errorString();
    5. return 1;
    6. }
    7. qDebug() << "No Error ";
    8.  
    9. process.waitForFinished(-1); // will wait forever until finished
    To copy to clipboard, switch view to plain text mode 

    Console output : No Error ===> Process starts OK ??

    I have used QProcess with Gerrit without problems. exmple :
    Qt Code:
    1. process.start("ssh -p port user@host gerrit create-project test")
    To copy to clipboard, switch view to plain text mode 
    ===> Creates project in Gerrit OK

    Assuming of course that the git program is on your system's executable search path and that you have permission to execute it
    How can I be sure of it ??
    If Gerrit works without pbs ===> Git also works also ??

  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Simple : open system command line and type git<Enter>.

  4. #4
    Join Date
    Dec 2015
    Posts
    35
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Yes, I have

    I Have already used git clone on system command line whitout problem

    Qprocess with Gerrit works well

    QProcess with Git fails
    Qt Code:
    1. projectClone = "git clone ssh://user@host:port/Template.git";
    2. process.start(projectClone);
    3.  
    4. if (!process.waitForStarted()) {
    5. qDebug() << "Error : " << process.errorString();
    6. return 1;
    7. }
    8. qDebug() << "No Error" ;
    9.  
    10. if(process.waitForFinished())
    11. {
    12. qDebug() << "Error Waiting : " << process.errorString();
    13. return 1;
    14. }
    To copy to clipboard, switch view to plain text mode 

    Console output :
    No Error
    Error Waiting: "Unknown error"

  5. #5
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Is exactly the same command working in command line ?
    Do it need some sort of interaction ?

  6. #6
    Join Date
    Dec 2015
    Posts
    35
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Is exactly the same command working in command line ?
    Yes the same :
    Qt Code:
    1. git clone ssh://user@host:port/Template.git
    To copy to clipboard, switch view to plain text mode 

    Do it need some sort of interaction ?
    No, just the previous command

    Cmd line screenshot: Capture du 2016-05-19 14:15:53.png

  7. #7
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    I have no idea

  8. #8
    Join Date
    Dec 2015
    Posts
    35
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Hii,

    There is no error in the programm
    Qt Code:
    1. projectClone = "git clone ssh://user@host:port/Template.git";
    2. process.start(projectClone);
    3.  
    4. if (!process.waitForStarted()) {
    5. qDebug() << "Error : " << process.errorString();
    6. return 1;
    7. }
    8.  
    9. if(!process.waitForFinished())
    10. {
    11. qDebug() << "Error Waiting : " << process.errorString();
    12. return 1;
    13. }
    To copy to clipboard, switch view to plain text mode 

    But, I don't see the project in my directory
    With cmd line, I see the project

  9. #9
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Before process.start() put in code :
    Qt Code:
    1. qDebug() << QDir::current();
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Dec 2015
    Posts
    35
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess - Git

    Thanks it works

Similar Threads

  1. QProcess crashes second QProcess
    By Ion in forum Newbie
    Replies: 1
    Last Post: 23rd September 2014, 21:00
  2. Replies: 1
    Last Post: 3rd June 2013, 13:11
  3. Replies: 0
    Last Post: 23rd March 2013, 19:23
  4. Replies: 0
    Last Post: 26th August 2010, 10:44
  5. QProcess inside QProcess
    By bunjee in forum Qt Programming
    Replies: 7
    Last Post: 4th December 2008, 00:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.